开发者

JSF h:selectManyCheckbox valueChangeEventListener not fired when user unchecks all

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 click event than the change event.

onclick="submit()"

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜