Details
Description
This is related to bug 2486.
This change broke the ability to handle nested boolean properties. For instance, to extend that example, if you did <g:checkBox name="book.author.isFamous" and then bindData(book, params['book']) the params come in as "book.author._isFamous". In order for this example to work, it needs to be "book._author.isFamous".
For now I am using a custom tag that allows a "base" attribute to determine where to put the _.
<sf:checkBox name="book.author.isFamous" base="book"> => book._author.isFamous.
Then when base is left off it puts the underscore before the entire property name. I think that makes more sense but it is a breaking change.
Open to other workarounds as well.
Attachments
Issue Links
| This issue relates to: | ||||
| GRAILS-6313 | Regression: params with underscores automap differently from prior grails versions |
|
|
|
| GRAILS-4544 | g:checkBox doesn't set to false booleans of domain objects bound to a sub-hash of params. |
|
|
|
| This issue is related to: | ||||
| GRAILS-6224 | Support checkbox fields on nested command objects with Spring data binding |
|
|
|
| GRAILS-2486 | g:checkBox doesn't set to false booleans of domain objects bound to a sub-hash of params. |
|
|
|
I concur, this issue still exists in 1.2.0.
I have attached an application that shows the problem. Run the application and browse to http://127.0.0.1:8080/GrailsNestedBinding.
There are two pages that correspond to two actions on the same controller and domain instances. They both update a nested boolean property, viz. parent.children[0].visible. After the update action we redirect to the same page so that the boolean status can be seen conveniently.
I hope this helps.