Solved

make listbox items include several space characters?

Posted on 2001-07-26
13
235 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
 
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
DevOps Toolchain Recommendations

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

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
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 …
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
The viewer will learn how to dynamically set the form action using jQuery.

910 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now