Solved

make listbox items include several space characters?

Posted on 2001-07-26
13
240 Views
Last Modified: 2013-11-18
how to list the following 3 items in listbox?
"test 1","test   2","test      3".
thanks!
0
Comment
Question by:jyx
  • 5
  • 4
  • 2
  • +2
13 Comments
 
LVL 5

Expert Comment

by:raizon
ID: 6324230
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>
0
 

Author Comment

by:jyx
ID: 6324310
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!
0
 
LVL 5

Expert Comment

by:raizon
ID: 6324385
can you show me the code you are using?
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 19

Expert Comment

by:webwoman
ID: 6324579
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.
0
 
LVL 2

Expert Comment

by:Schells_Web_Design
ID: 6326832
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>
0
 
LVL 5

Accepted Solution

by:
raizon earned 50 total points
ID: 6326864
problem with that Schells would be calling on the selected value for that select box.  You want to keep your values as descriptive/usefull as possible, cause you are going to be calling on them later.  jyx is calling on them to point to either a URL or a File.  The spaces will cause problems with the user reaching the specified URI in some browsers such as Netscape.
0
 
LVL 2

Expert Comment

by:Schells_Web_Design
ID: 6327418
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.

0
 
LVL 18

Expert Comment

by:bruno
ID: 6327431
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
0
 

Author Comment

by:jyx
ID: 6327537
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.
0
 
LVL 5

Expert Comment

by:raizon
ID: 6327546
sounds great jyx.  Good luck and let us know if we can help further.
0
 

Author Comment

by:jyx
ID: 6327558
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%>
0
 

Author Comment

by:jyx
ID: 6327567
Anyway thanks for all your help. I appreciate that.
Good luck and enjoy your programming!
0
 
LVL 5

Expert Comment

by:raizon
ID: 6327835
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
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question