mercredi 20 mai 2015

my checkbox pass value even unchecked - grails

I have lots of checkbox on my grails form, one is this:

<g:checkBox id="consolidate" name="consolidate" value="${true}" checked="${false}" />

Then on the receiving controller, I verify the value of the checkbox using this code:

println params?.consolidate

And it displays:

on

Regardless whether I've tick my checkbox or not. In other language, if the checkbox is not ticked, its value on the controller will be null or undefined. What should be its value when unchecked, and what is the right code to access its value on the grails controller?




Aucun commentaire:

Enregistrer un commentaire