So here is the opposite to the oft asked “how to I render messages to more than one form”. I have two forms on one page, and after validation in one form, the summary error (if validation fails) shows up on both forms below the submit buttons. If the code succeeds in sending the required email the confirmation message also shows up in both forms. They should only show up in the form which was submitted. The message below the inputTexts work as they should. What am I doing wrong?
<p:panel>
<h:form id="id_rememberUserNameForm" prependId="false">
<td>
...
<p:inputText
id="id_existingEmailAddress"
styleClass="registerinputtext width_20em"
size="20"
maxlength="60"
value="#{credentialsManagementBean.emailAddress}"
validator="#{multivalidator.validateEmailExists}" >
<f:ajax event="blur" render="id_noSuchEmailError" />
</p:inputText>
</td>
</tr>
<!-- validation error handling +++++++++++++++++ -->
<tr class="errorMessage min_height_1p5em">
<td colspan="2" >
<h:message for="id_existingEmailAddress"
id="id_noSuchEmailError"
showDetail="false"
showSummary="true"/>
</td>
</tr>
</table>
<p:commandButton id="id_remindUsernameButton"
value="Retrieve Username"
action="#{credentialsManagementBean.rememberUsername}" >
<f:ajax execute="id_rememberUserNameForm" render="id_UserReminderMessage" />
</p:commandButton>
<p:messages id="id_UserReminderMessage"
showSummary="false"
showDetail="true"
autoUpdate="true" />
</h:form>
</p:panel>
<!-- next form +++++++++++++++++ -->
<p:panel>
<h:form id="id_resetPasswordForm" prependId="false">
...
<p:inputText
id="id_existingUsername"
styleClass="registerinputtext width_20em"
size="20"
maxlength="20"
value="#{credentialsManagementBean.username}"
validator="#{multivalidator.validateUsernameExists}">
<f:ajax event="blur" render="id_noSuchUserError" />
</p:inputText>
</td>
</tr>
<!-- validation error handling +++++++++++++++++ -->
<tr class="errorMessage min_height_1p5em">
<td colspan="2" >
<h:message for="id_existingUsername"
id="id_noSuchUserError"
showDetail="true"
showSummary="false"/>
</td>
</tr>
</table>
<p:commandButton id="id_resetPasswordButton"
value="Retrieve Username"
action="#{credentialsManagementBean.resetPassword}" >
<f:ajax execute="id_resetPasswordForm" render="id_pwResetMessage" />
</p:commandButton>
<p:messages id="id_pwResetMessage"
showSummary="true"
showDetail="false"
autoUpdate="true" />
</h:form>
</p:panel>
Using an update on
<p:commandButton>looks working. So try this:as
<p:commandButton>default is ajax submit, you do not need<f:ajax>