My problem is that when the user unchecks everything (leaving 0 checkboxes checked) JSF does not fire the valueChangeListener.
I appreciate any help, thanks.
JSPX:
<h:selectManyCheckbox
value="#{EME01.selectedMaterials}"
valueChangeListener="#{EME01.materialsValueChangeListener}"
onchange="submit();">
<f:selectItems value="#{EME01.materials}" />
</h:selectManyCheckbox>
Backing bean (EME01):
public void materialsValueChangeListener(ValueChangeEvent e) {
System.out.println("hello");
}
For checkboxes (and radio buttons) you’re rather interested in
clickevent than thechangeevent.Unrelated to the concrete problem, consider using Ajax for this as it’s pretty bad user experience to submit the entire form and have a flash of content on every change/click of the checkbox. If you’re already on JSF2 for example, use
<f:ajax>instead.