Forum Moderators: open

Message Too Old, No Replies

Space character in Select Option Value

         

peterinwa

6:09 am on Mar 28, 2003 (gmt 0)

10+ Year Member



It appears that I can put any alphanumeric character or punctuation symbol in a text string that is the value of a Select Option, e.g.:

<option value=45,0,0,10,0,1 oz/28 g>Barbeque Sauce

except the space character. When I read the above value, I get only:

45,0,0,10,0,1

It stops with the last character before the first space.

I can get around this by replacing each space with & nbsp; (without the space after the &; I did that so it would show here) but this is not very practical as it takes a lot of bytes and is hard to edit.

Is there a way around this? Obviously it's not what Value was designed to do!

Thanks, Peter

toadhall

6:20 am on Mar 28, 2003 (gmt 0)

10+ Year Member



Did you try putting the value in quote marks?

"45,0,0,10,0,1 oz/28 g"

peterinwa

6:47 am on Mar 28, 2003 (gmt 0)

10+ Year Member



Easy! Works great... many thanks!

g1smd

7:03 am on Mar 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Remember to "Quote" all attributes, especially all "#FFFFFF" colors, all URLs, all "50%" sizes, and any other attribute value that contains anything other than a simple "A" to "Z" or "0" to "9" value. In HTML 4.01 it is recommended to quote all attribute values.

Run your code through the checker at [validator.w3.org...] to find other errors that may cause problems in some browsers.

peterinwa

7:41 am on Mar 28, 2003 (gmt 0)

10+ Year Member



I'll start doing that better. I quote the obvious like font colors, but not much else... obviously why I got in trouble. It's just that it so very rarely causes trouble.

But that's a good place to draw the line. I'll start quoting anything except A-Z 0-9.

Thanks!

DrDoc

7:54 am on Mar 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You should probably start quoting everything. Beginning with XHTML quotes are required on all attributes...