Hi,
Hoping someone can help me...
I have a JSP that contains a question...
If the user selects 'Yes', I need to display a select box with values a, b, c.
If the user selects 'No', I need to reveal a select box with values a, b & c but with extra values d & e.
At the moment, I have some javascript which works to toggle each box when the answer to the questions changes. Both boxes reference the same property in the bean.
The problem:
I can see that the value selected for each box is being held in memory, and this can result in an incorrect (previously selected) value being sent to the bean's set method.
Can someone help me with this?
Eg. Is there a way of conditionally displaying the options within a select box (that way only one box would be required) or a way of uniquely identifying each box so perhaps the value in memory can be cleared when the user changes their mind?
The boxes are currently defined something like this:
<html:select property="employmentStatus">
<html:option value="a">Please select</html:option>
<html:option value="b">Employed</html:option>
<html:option value="c">Self-employed</html:option>
</html:select>
<html:select property="employmentStatus">
<html:option value="a">Please select</html:option>
<html:option value="b">Employed</html:option>
<html:option value="c">Self-employed</html:option>
<html:option value="d">Retired</html:option>
<html:option value="e">Other</html:option>
</html:select>
(sorry, the real code is at work and I'm home now!)
Any help greatly appreciated.