I have a RichFaces pickList from which the user should be able to select multiple items and it should be directly reflected on the backing bean. Right now I have no way to reload selection in case of a validation error or in case the page is reloaded. Is there a simple way to tell RichFaces that I want the backing list to be updated on every change?
You can attach to onlistchange
event.
Using a4j:support
:
<rich:pickList ...>
<a4j:support event="onlistchange"/>
</rich:pickList>
Or, in newer versions, using a4j:ajax
:
<rich:pickList ...>
<a4j:ajax event="change" render="result"/>
</rich:pickList>
Or using a4j:jsFunction
:
<rich:pickList onlistchange="listChange();"... />
<a4j:jsFunction name="listChange" />
Both approaches in the form above will submit the form causing submitting selected values. You can also specify additional attributes for a4j:support
/a4j:jsFunction
if needed (for example ajaxSingle="true"
for a4j:support
to process only pickList component (other inputs will not be validated/updated), action
/actionListener
to execute server side logic when list is changed, reRender
, etc.).