Affects Version/s: 1.0.1.RELEASE
Fix Version/s: None
Component/s: WEB MVC
Imagine a reference field that can be null (e.g. a Car can have a Radio or not). There are two problems with the auto-generated views for the Car entity (assuming some Radios have already been added to the database):
- in car/create.jspx, the "Radio" drop-down defaults to blank, but if no Radio is selected, the form fails to submit and shows no error (presumably there is a binding and/or validation problem)
- in car/update.jspx, you can't change a Car from having a Radio to not having a Radio, because the select tag doesn't have a null option even though the Car.radio field can be null in Java.
Here's a test script that demonstrates the problem:
Here's the original view code for the "Radio" field (in both the above views):
To fix this, you have to edit both create.jspx and update.jspx to include a null option like this:
And register a custom PropertyEditor in CarController as follows:
This workaround should not be necessary, given that Roo knows all along that the field can be null.