after certain validations are violated
I\'m populating
from a database which contains a list of zones, when a JSF page loaded.
When a zone in this menu is selected, a
Basically, you need the functionality provided by <p:resetInput>
inside <p:ajax>
of a <p:selectOneMenu>
. This is indeed not possible as <p:resetInput>
requires being placed in a component implementing ActionSource such as UICommand
components.
Your best bet is to let <p:remoteCommand>
take over the <p:ajax>
change listener job. Therein you can put a <p:resetInput>
.
Imagine that you currently have a:
<h:form>
<p:selectOneMenu id="zone">
<f:selectItems ... />
<p:ajax listener="#{bean.changeZone}" update="data" />
</p:selectOneMenu>
<p:panel id="data">
...
</p:panel>
</h:form>
Then this change should do:
<h:form>
<p:selectOneMenu id="zone" onchange="changeZone()">
<f:selectItems ... />
</p:selectOneMenu>
<p:remoteCommand name="changeZone" process="@this zone" action="#{bean.changeZone}" update="data">
<p:resetInput target="data" />
</p:remoteCommand>
<p:panel id="data">
...
</p:panel>
</h:form>
Don't forget to remove the AjaxBehaviorEvent
argument from the listener method. It's useless in this particular case anyway.