Avoid submitting whole page after html5-validation

2019-09-11 21:16发布

问题:

I have a primefaces commandButton in myForm which should submit only this specific form. If I do the form-validation with form.checkValidity() and it returns true, the whole page gets submitted. How can I avoid submitting the whole page and submit only the specified area?

    <p:commandButton
        action="#{registrationController.register}" onclick="regForm[0].checkValidity()"
        partialSubmit="true" process="regForm" update="regForm" 
        value="#{messages['register.registerbutton']}" />