retrieving value from select tag using getParamater()

liunx

Guest
Hi<br />
<br />
This is a html question mixed with java.<br />
<br />
I have a list of values that contain whitespace displayed in a html select tag. i.e.,<br />
<br />
<select name="carlist" size=12><br />
<option value=mazda323>Maxda 323 LX</option><br />
<option value=mazda626>Maxda 626 Saloon</option><br />
etc<br />
</select><br />
<br />
This is part of a form that uses "post" as its method. After selecting a value, for eg, "Mazda 323 LX", I click on the submit button which brings me back to the main servlet. Here, in the doPost(), I retrieve the value selected using HttpServletRequest.getParameter("carlist");<br />
<br />
This returns only "Mazda". Its like it only gets as far as a the first whitespace it sees. But when I try this method on a input field which contains text "Mazda 323 LX", it retrieves the whole lot, ie "Mazda 323 LX".<br />
<br />
Is is a quirke of html select tags or am I missing something?<br />
<br />
I have tried calling HttpServletRequest.getParameterValues("carlist") but it still only returns the first word in the string.<br />
<br />
Any ideas?<!--content-->well for one the vlaue of the option gets sent, not the text in the option.<br />
<br />
so it seems that something is wrong on your end. because it shuld send this in the form<br />
<br />
carlist=mazda323<br />
<br />
if I was to pick the first one.<!--content-->
 
Back
Top