You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by "Seema Richard (UST, IND)" <Se...@ust-global.com> on 2010/09/28 11:13:29 UTC

[Trinidad} Issue with ValueChangeListener

Hi,

 

We are using Trinidad 1.2 with facelets.There are multiple checkboxes in
our form and we require to call an ActionListener every time a checkbox
is selected/deselected. 

 

Below is the code:

<tr:form>

<tr:selectBooleanCheckbox autoSubmit="true"

id="quantity1"
valueChangeListener="#{simpleBackingBean.processValueChange}"/>

<tr:selectBooleanCheckbox autoSubmit="true"

id="quantity2"
valueChangeListener="#{simpleBackingBean.processValueChange}"/>

<tr:selectBooleanCheckbox autoSubmit="true"

id="quantity3"
valueChangeListener="#{simpleBackingBean.processValueChange}}"/>

</tr:form>

What happens here is every time the checkbox is selected/deselected the
listener method is invoked 3 times, one for each component having the
valuechangeListener attribute. We have tried to remove the autoSubmit
attribute from the check box components but then nothing happens on
selection / deselection.

 Is there a way by which we can get just the changed checkbox value when
it is clicked?

Thanks,

Seema

 

 


Re: [Trinidad} Issue with ValueChangeListener

Posted by Cédric Durmont <cd...@gmail.com>.
Hi,

What's the scope of the bean ? If it's a request bean, then this is normal...
Otherwise, the valueChangeListener is not called until the new value
differs from the old one.
Try to put a breakpoint in simpleBackingBean.processValueChange and
compare old and new value as given in the event object.
Maybe the values are "roughly the same" but oldValue.equals(newValue)
returns false for a reason or another. Or, something else changes the
value in between.
Hope this may lead you to your problem...

Regards,
Cedric

2010/9/28 Seema Richard (UST, IND) <Se...@ust-global.com>:
> Hi,
>
>
>
> We are using Trinidad 1.2 with facelets.There are multiple checkboxes in
> our form and we require to call an ActionListener every time a checkbox
> is selected/deselected.
>
>
>
> Below is the code:
>
> <tr:form>
>
> <tr:selectBooleanCheckbox autoSubmit="true"
>
> id="quantity1"
> valueChangeListener="#{simpleBackingBean.processValueChange}"/>
>
> <tr:selectBooleanCheckbox autoSubmit="true"
>
> id="quantity2"
> valueChangeListener="#{simpleBackingBean.processValueChange}"/>
>
> <tr:selectBooleanCheckbox autoSubmit="true"
>
> id="quantity3"
> valueChangeListener="#{simpleBackingBean.processValueChange}}"/>
>
> </tr:form>
>
> What happens here is every time the checkbox is selected/deselected the
> listener method is invoked 3 times, one for each component having the
> valuechangeListener attribute. We have tried to remove the autoSubmit
> attribute from the check box components but then nothing happens on
> selection / deselection.
>
>  Is there a way by which we can get just the changed checkbox value when
> it is clicked?
>
> Thanks,
>
> Seema
>
>
>
>
>
>