Reputation: 209
Is it possible to submit a JSF form with the help of a checkbox?
I have multiple checkboxes and when I click on one of them, then it should actually submit the form and go to the next page. The checkbox value should be bound to a backing bean.
Upvotes: 4
Views: 2922
Reputation: 1520
With JSF 1.x you can do:
<h:selectBooleanCheckbox value="#{aBean.aFiled}" onclick="submit()" />
If you use JSF 2.x, then you can use ajax:
<h:selectBooleanCheckbox value="#{aBean.aFiled}">
<f:ajax event="click" execute="@form" />
</h:selectBooleanCheckbox>
For JSF and ajax take a look at: Learning JSF2: Ajax in JSF – using f:ajax tag
Upvotes: 8