How do i get all Non Selected and Selected checkbox values in controller?
Gsp Code :
<g:each in="${userlist}" status="i" var="userInstance">
<g:checkBox name="userInstanceList" value="${userInstance?.id}"/>
</g:each>
How do i get all Non Selected and Selected checkbox values in controller?
Gsp Code :
<g:each in="${userlist}" status="i" var="userInstance">
<g:checkBox name="userInstanceList" value="${userInstance?.id}"/>
</g:each>
By default browsers do not submit values for checkboxes that are not checked. You have two options.
Obtain a list of the set of data in the controller which makes up the entire set and remove the values which are checked, leaving you with the "unchecked" values.
Use Javascript or JQuery to iterate through the checkboxes, collecting the values of the unchecked checkboxes and setting a hidden field to that value. (e.g. 1,4,7).