Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.0.1
-
Fix Version/s: 1.0.2
-
Component/s: None
-
Labels:None
Description
The hidden field generated by g:checkBox places the underscore at the beginning of the checkBox's name even if the name has periods (dots) in it, so that it's not included when binding a "sub-hash" of params to a domain object. For example, if the Book class has a paperback boolean, then a checkbox declared as:
<g:checkBox name="book.paperback" />
and bound in the controller with:
new Book(params['book'])
or:
book.properties = params['book']
will not set the paperback property to false if the checkbox is unchecked. This is because the hidden field generated by the g:checkBox tag has the name _book.paperback. Changing this (for example, by using straight HTML instead of the g:checkBox tag) to book._paperback seems to fix the problem, which suggests that the g:checkBox tag should prepend the _ to the last component of the dotted name, rather than to the name as a whole.
Issue Links
| This issue relates to: | ||||
| GRAILS-3299 | checkBox does not work for nested boolean properties |
|
|
|
fixed