Solved

make listbox items include several space characters?

Posted on 2001-07-26
13
226 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
Comment Utility
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
Comment Utility
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
Comment Utility
can you show me the code you are using?
0
 
LVL 19

Expert Comment

by:webwoman
Comment Utility
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
Comment Utility
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
Comment Utility
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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 2

Expert Comment

by:Schells_Web_Design
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
sounds great jyx.  Good luck and let us know if we can help further.
0
 

Author Comment

by:jyx
Comment Utility
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
Comment Utility
Anyway thanks for all your help. I appreciate that.
Good luck and enjoy your programming!
0
 
LVL 5

Expert Comment

by:raizon
Comment Utility
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

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.
I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
The viewer will learn how to count occurrences of each item in an array.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

763 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

7 Experts available now in Live!

Get 1:1 Help Now