Skip to Main Content

issues passing dropdown value back to java

malkyMar 25 2013 — edited Mar 25 2013
I have a bunch of select tags in my page where some of them allows the user to use the dropdown and some of them will be disabled at a given time. so I have a select tag in my jsp such as:

<html:select name="myobject" property="myfield" disabled="$(isDisabled ? 'disabled' : '')"/>

I wanted to set as readonly a select tag on my jsp but apparently is not possible so I had to put disable. Since disabled values are not passed back to the application when a user submits the action I created a hidden object of it to pass it as it's suggested everywhere to work around that...

<html:hidden name="myobject" property="myfield" indexed="true"/>

The problem is.. when the form is submited I don't get the new dropdown value selected by the user, I debug into my java code and what I receive is the value that was originally sent to the page instead of what the user picked. It works if I removed the hidden field but if I do so then the disabled selections won't displayed when refreshed cause disabled fields don't pass back the values and i'll receive null at my end... how do I fix this problem?

Post Details
Added on Mar 25 2013