How do I process a checkbox input in Play! Framework? Should I catch the value as a String at the controller? How to get what values are checked by a user?
This is the html code of my checkbox
#{list items:categories, as:'category'}
<tr>
<td><input type="checkbox" name="category" id="category-${category.name}" value="${category.id}" /><label for="category-${category.name}"> ${category.name}</label></td>
</tr>
#{/list}
I think if you have a
List<String> category
in your form action, you will get a list of value of checked items.Thanks to Cristian Boariu, here is the link for your inspiration:
http://crisdev.wordpress.com/2012/05/19/play-framework-get-checkbox-value-from-view-in-controller/