Michael Borgwardt
2009-02-27 22:53:54 UTC
I am developing a Grails (1.0.4) app where I want to edit a collection of
collections on a single page in a grid view. I got it to work quite well
depending only on the standard grails magic (which is, I believe, provided
by Spring MVC) using indexed parameters, except for one thing:
boolean (or, for that matter, Boolean) values in the grid can be set via
checkbox, but not unset, i.e. when I check the checkbox and update, the
value is set to true, but afterwards when I edit again, uncheck the checkbox
and update, it remains true.
This is the GSP code of the checkbox:
<g:checkBox name="tage[${indexTag}].zuweisungen[${indexMitarb}].fixiert"
value="${z.fixiert}" />
And this is the HTML that is generated:
<input type="hidden" name="tage[0].zuweisungen[0]._fixiert" />
<input type="checkbox" name="tage[0].zuweisungen[0].fixiert"
checked="checked" id="tage[0].zuweisungen[0].fixiert" />
The controller's update action is provided by dynamic scaffolding.
I've found a Grails bug that describes exactly this effect:
http://jira.codehaus.org/browse/GRAILS-2486
But it's marked as fixed in 1.0.2, and the problem mechanism described there
(underscore in hidden field name is put in the wrong place) is not present
in my case.
Any ideas what could be the reason? Is it the nested indexing?
Thanks,
Michael
collections on a single page in a grid view. I got it to work quite well
depending only on the standard grails magic (which is, I believe, provided
by Spring MVC) using indexed parameters, except for one thing:
boolean (or, for that matter, Boolean) values in the grid can be set via
checkbox, but not unset, i.e. when I check the checkbox and update, the
value is set to true, but afterwards when I edit again, uncheck the checkbox
and update, it remains true.
This is the GSP code of the checkbox:
<g:checkBox name="tage[${indexTag}].zuweisungen[${indexMitarb}].fixiert"
value="${z.fixiert}" />
And this is the HTML that is generated:
<input type="hidden" name="tage[0].zuweisungen[0]._fixiert" />
<input type="checkbox" name="tage[0].zuweisungen[0].fixiert"
checked="checked" id="tage[0].zuweisungen[0].fixiert" />
The controller's update action is provided by dynamic scaffolding.
I've found a Grails bug that describes exactly this effect:
http://jira.codehaus.org/browse/GRAILS-2486
But it's marked as fixed in 1.0.2, and the problem mechanism described there
(underscore in hidden field name is put in the wrong place) is not present
in my case.
Any ideas what could be the reason? Is it the nested indexing?
Thanks,
Michael