[thelist] Send hidden data from a form

Benjamin Hawkes-Lewis bhawkeslewis at googlemail.com
Tue Dec 30 05:17:42 CST 2008


On 30/12/08 03:06, Santilal Parbhu wrote:
> I am trying to overcome a problem where the data received from an HTML form
> menu is being truncated when a space is seen.  For example, if the option
> value of Red Sox is sent, it is truncated to Red.
>
>
>
> I have not been able to find an answer to this for over a year now.  I
> thought that another way to tackle this would be to send a hidden code with
> each option value: for example; Red Sox, Code = 123, Blue Sox, Code  = 124
> etc.

There's nothing wrong with using numeric codes (and it might be better 
for internationalization reasons). But it shouldn't be necessary.

<option value="Red Sox">Red Sox</option> should work fine.

http://www.w3.org/TR/html401/interact/forms.html#adef-value-OPTION

Possible problems include:

1. Mismatch of encodings producing corruption of data.
2. Some other error in your form submission processing script.

I'd be interested to see an example of a simple script showing the 
problem you've been having.

Here's a simple test case (saved and served as UTF-8) that demonstrates 
that spaces in option values work fine (tested in Firefox 3 Mac and IE6).

http://paste-bin.com/view/2ecbfbc2

--
Benjamin Hawkes-Lewis



More information about the thelist mailing list