Reputation: 890
I am using JSF and Primefaces in my web application.
In this i am using one form which includes some some details to be filled by student. So there is some validation on that fields
And, On this page there are two button one is Submit and Other is Logout
When I pressed submit button form is displaying validation error if details are not completed.
But Same things also shown while pressing LOGOUT link also
Logout is p:commadLink
<p:commandLink styleClass="logout" type="submit" action="#{userManagedBean.logout}">
<p:graphicImage value="/images/logout.png"></p:graphicImage>
</p:commandLink>
Submit is h:commandButton
<h:commandButton image="/images/submit_button.png" type="submit" action="#{referManagedBean.saveDetails}" value="submit"></h:commandButton>
I need Logout link skip this validation step and directly goes to managed bean called function.
How can i skip Validation Step ??
Upvotes: 1
Views: 2174
Reputation: 4114
Since the log-out action seems that has nothing to do with the details form (being validated), you could just move the button to different form (h:form) so it wouldn't trigger the details form validation anyway.
Upvotes: 3
Reputation: 890
I solved my problem i used immediate="true" by which it skips the validation phase.
<p:commandLink styleClass="logout" type="submit" immediate="true" action="#{userManagedBean.logout}">
<p:graphicImage value="/images/logout.png"></p:graphicImage>
</p:commandLink>
Upvotes: 2