to call valueChangeListener?
Using PF 3.0-RC1 Snapshot (11/22/2011)
I have a in a composite component. I want to call the valueChangeListener when a selection is made, but it does not appear to
You seem to be expecting that the valueChangeListener
method in the server side is called immediately when a change event occurs on the client side. This is not correct. It will only be invoked when the form is submitted to the server and the new value does not equals()
the old value.
There are at least two ways to achieve your functional requirement:
Add onchange="submit()"
so that JavaScript will submit the form whenever you change the value:
This is however very JSF-1.x-ish and poor for user experience. It will also submit (and convert/validate!) all other input fields which may not be what you want.
Make use of an ajax listener instead, for sure if you are not interested in the actual value change (i.e. the old value is not interesting for you), but you're actually interested in the change event itself. You can do this using
or in PrimeFaces components using
:
And replace the ValueChangeEvent
argument by the AjaxBehaviorEvent
argument.