Forum Moderators: open

Message Too Old, No Replies

Spaces in option value?

Is it legal? Does it work on all major browsers?

         

Clark

9:24 am on Nov 12, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Is this legal?

<form method="post" action="program.pl" name="hello">
<select name="choices">
<option value="these are embedded spaces">Choice 1</option>
<option value="more embedded spaces">Choice 2</option>
</select>
</form>

Will it cause problems in any browsers or is the fact that it's a POST method cause the spaces to automatically get inserted?

rocknbil

6:00 pm on Nov 12, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



AFAIK it is a perfectly valid value. The spaces are maintained whether it's post or get.

JeffSela

6:07 pm on Nov 12, 2005 (gmt 0)

10+ Year Member



Yes, that should work fine in all browsers. The spaces will be encoded in the POST (or GET) request by the browser.

The only escaping you have to worry about there is making sure that the attribute values are valid HTML, so things like '&' need to be escaped as '&amp;'. They'll get sent as just '&' when the form is submitted, so you don't need to worry about that on the receiving end.

Clark

11:23 pm on Nov 12, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks.