I have a dialog which is closed with the following button:
<p:commandButton
onclick="propertyEditDialog.hide(),propertyEditDialog.loaded=false"
value="#{i18n['button.cancel']}" ajax="true"/>
There is no action, only client side javascript that simply hides the dialog. However, I’ve seen in the logs, that the form is validated on cancel. I’ve set the ajax="true" to prevent form validation, but it not helped anyway.
What is the right way to close the dialog in PrimeFaces without validating the form?
ajax="true"is the default behaviour ofp:commandButton!The right way would be to exclude the inputs of beeing processed. With the attribut
process="@this"in the commandButton, only the button should be processed.But if you dont want to fire some action and do not want to submit the form, maybe you better use a push-button (instead of a submit-button) by adding the attribute
type="button"to your commandButton.