Given a map o with the following values Map o; o.put("one", "1"); o.put("2", "2"); comes out in the html as <option value="1">one</option> <option>2</option> Which is quite unhandy if you wish to submit the form... I've looked at the sources and I am confused by the following code snippet: private void outputOption(...){ ... if (!value.equals(key)) out.print(" value=\"" + Util.quote(value) + "\""); ... It looks very intentional so maybe I am missing some important aspect?
> Which is quite unhandy if you wish to submit the form... correction on the submit part. That actually works fine. But I have to use JavaScript.
Per the HTML standards, the value is equal to the key by default. Are you experiencing behavior by some browser that suggests this isn't the case?
Created attachment 4737 [details] Example of select in combination with javascript
You are correct that the value of the request parameter in the GET/POST of the form will have the value of the label if no value exists. However, the browser all work a little bit different when it comes to selects and javascript. document.frm.theSelect.value Ne4: Allways returns null, even if there is a value IE: Returns a value, not the label Mozilla: Works like a charm! document.frm.theSelect.options[document.frm.theSelect.selectedIndex].value Ne4 and IE Returns a value, not the label Mozilla: Works like a charm! document.frm.theSelect.options[document.frm.theSelect.selectedIndex] Always returns an object. Probably an option Mozilla follows standard, IE 6.0.26 and Ne 4.79 do not.