Link to home
Start Free TrialLog in
Avatar of jyx
jyx

asked on

make listbox items include several space characters?

how to list the following 3 items in listbox?
"test 1","test   2","test      3".
thanks!
Avatar of raizon
raizon

This would work.

<select size=4 multiple>
  <option value=1>test 1</option>
  <option value=2>test &nbsp;&nbsp;2</option>
  <option value=3>test &nbsp;&nbsp;&nbsp;3</option>
</select>
Avatar of jyx

ASKER

yes that is exactly what I'm using. In the listbox I show all the file names, and when the user click print button I will print those selected files. The file names look  exactly ok, however when I try to print them, it seems these "&nbsp;" is not real space character so I can not locate those files at all.
Help!
can you show me the code you are using?
What kind of files? If you're printing from the browser, you have to load it in the browser. If it's not an HTML doc, it's going to have to open in the proper app for you to print it.

Trying to force things to print from a browser is hard enough -- trying to make them print without loading them is pretty much an exercise in futility. You might be able to do it if you use some fancy ActiveX controls.
As a variation on what  "raizon" stated earlier - how about this?

<select>
   <option value="test 1">test 1</option>
   <option value="test   2">test   2</option>
   <option value="test     3">test     3</option>
</select>
ASKER CERTIFIED SOLUTION
Avatar of raizon
raizon

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Gotcha - I agree on that one. I re-read the earlier posts and see what he's trying to do. I did not read into that the first time I read the posts.

you should NOT have spaces in your filenames if you are trying to link to them....rename your files with underscore where all the spaces_were_before...

BRUNO
Avatar of jyx

ASKER

thanks everyone. I fixed that problem by using the VALUE property of the listbox item to pass the file names to my OCX to print them. I was very stupid to use the TEXT property of the listbox to pass the file names as the parameter.
sounds great jyx.  Good luck and let us know if we can help further.
Avatar of jyx

ASKER

The following are my current code:
     
<%Set objFileSystem = CreateObject("Scripting.FileSystemObject")

Set objFolder = objFileSystem.GetFolder(filepath)

Set objFiles = objFolder.Files
If objFiles.Count > 0 Then
For Each objItem in objFiles%>

<option value="<%=filepath & "\" & objitem.name%>">
<%filenamenew= replace(objitem.name," ","&nbsp;")
response.write filenamenew%>
</option>

<%Next
End If%>
Avatar of jyx

ASKER

Anyway thanks for all your help. I appreciate that.
Good luck and enjoy your programming!
Only thing that I would change jyx is in your replace statment.  

Change

<option value="<%=filepath & "\" & objitem.name%>">
<%filenamenew= replace(objitem.name," ","&nbsp;")
response.write filenamenew%>
</option>

To

<option value="<%=filepath & "\" & objitem.name%>">
<%filenamenew= replace(objitem.name," ","%20")
response.write filenamenew%>
</option>


%20 is the URL encoding for a space.

Good luck and have fun.

BTW......thanks for the points and the A