I'm using JSF 2 with PrimeFaces 4.0.
I have a form with some inputs and validation. Some fields may automatically filled when choosing an entity from a dialog. This works fine when I choose the entity before I submit the whole form (and validate). But when I choose an entity after validation the update of the component does not work.
JSF page:
<h:form id="form">
<p:inputText id="id" value="#{bean.user.id}" required="true"
onclick="PF('usersDialog').show()" />
<p:inputText id="name" value="#{bean.user.name}" required="true"
onclick="PF('usersDialog').show()" />
<p:commandButton value="submit" action="#{bean.submit}" update=":form" />
</h:form>
<p:dialog widgetVar="usersDialog">
<h:form>
<p:dataTable value="#{bean.users}" var="user">
<p:column>
<p:commandButton value="choose" onclick="PF('usersDialog').hide()"
process="@this" action="#{bean.select(user)}" update=":form" />
</p:column>
<p:column>
<h:outputText value="#{user.name}" />
</p:column>
</p:dataTable>
</h:form>
</p:dialog>
I know its up to the JSF lifecycle, but I'm not able to fix it.
So how can I update the form after validation fail when choosing an new entity from dialog?
Thanks in advance.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…