Sanath
Sanath

Reputation: 4886

JSF 2 valuechangeListener on checkbox works only for uncheck

<a4j:ajax render="tree">
<h:selectBooleanCheckbox id="checkEntry" value="#{bean.selected}" immediate="true"  disabled="false" valueChangeListener="#{bean.changeActive}"/>
  </a4j:ajax>

My checkbox for JSF is triggering the event "bean.changeActive", when I uncheck my checkbox..but when rechecking it, it doesn't trigger The form tag is properly used.. any help on this regard is appreciated..

Upvotes: 2

Views: 7833

Answers (1)

BalusC
BalusC

Reputation: 1109865

You're actually not interested in the value change event. You are interested in the click event. The checkbox value remains the same. It's only the checked state which changes. It's the checked state which controls whether the value will be sent or not.

Use the click event instead and attach a listener on it.

<a4j:ajax event="click" listener="#{bean.changeActive}" render="tree">

Upvotes: 2

Related Questions