O'Reilly logo

PrimeFaces Beginner's Guide by K. Siva Prasad Reddy

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – performing client-side validations

Let us see how we can create a User Registration form with regular JSF validators and converters, and perform validations using the PrimeFaces Client-side Validation framework, by performing the following step:

  1. Create a User Registration form and enable client-side validations by setting the validateClient attribute to true:
    <h:form id="registrationForm">
    <p:panel header="User Registration">
        <h:panelGrid columns="3">
            <p:outputLabel value="EmailId:*"/>
            <p:inputText id="emailId" value="#{userController.registerUser.emailId}" 
            label="EmailId" required="true">
            <f:validateRegex pattern="^[_A-Za-z0-9-\+]+(\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\.[A-Za-z0-9]+)*(\.[A-Za-z]{2,})$" /> </p:inputText> <p:message ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required