Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
1.4.9
-
None
Description
To reproduce using attached quick start:
1. Leave text field empty
2. Select a value in dropdown
3. Click submit link
4. The text field's validation will fail and the page will refresh with a validation error message
5. The dropdown's selected value will always be the first in the option list, no matter what value was selected in step 2.
As the dropdown is updating its model via the AJAX behaviour, the value selected in step 2 should be the one selected when the page is redisplayed.
We can workaround this like so:
final Select select = new Select("select", New Model<String>("")) {
@Override
protected void convertInput()
};
As this removes the rawInput from Select, Select.isSelected then evaluates the models to determine the selected option. I have attached a patch in universal diff format that fixes this behaviour, and have tested it under all render strategies. I haven't written a unit test for this as the bug ultimately relied on submitted values not being available in a request, and I wasn't able to determine how to emulate this in a unit testing environment. (Pointers more than welcome. )