Locale

Input Style

Free Themes

Built-in component themes created by the PrimeFaces Theme Designer.

PrimeOne Design

Saga Saga
Vela Vela
Arya Arya

Premium Themes

Premium themes are only available exclusively for PrimeFaces Theme Designer subscribers and therefore not included in PrimeFaces core.

bootstrap4-blue-light Bootstrap Blue
bootstrap4-purple-light Bootstrap Purple
bootstrap4-blue-dark Bootstrap Blue
bootstrap4-purple-dark Bootstrap Purple

Legacy Free Themes

Luna Amber Luna Amber
Luna Blue Luna Blue
Luna Green Luna Green
Luna Pink Luna Pink
Nova Nova
Nova Nova Alt
Nova Nova Accent

PREMIUM TEMPLATES

Create awesome applications in no time using the premium templates and impress your users.

Client Side Validation Custom

A custom client converter or a validator can be implemented easily. Both JSF and Bean Validation APIs are supported.


<script type="text/javascript">
    //<![CDATA[
    /**
     * Faces Validator
     */
    PrimeFaces.validator['custom.emailValidator'] = {

        pattern: /\S+@\S+/,

        validate: function (element, value) {
            //use element.data() to access validation metadata, in this case there is none.
            if (!this.pattern.test(value)) {
                throw {
                    summary: 'Validation Error',
                    detail: value + ' is not a valid email.',
                    severity: 'error'
                }
            }
        }
    };

    /**
     * Bean validator
     */
    PrimeFaces.validator['Email'] = {

        pattern: /\S+@\S+/,

        MESSAGE_ID: 'org.primefaces.examples.validate.email.message',

        validate: function (element, value) {
            var vc = PrimeFaces.validation.ValidationContext;

            if (!this.pattern.test(value)) {
                var msgStr = element.data('p-email-msg'),
                    msg = msgStr ? {summary: 'Validation Error', detail: msgStr, severity: 'error'} : vc.getMessage(this.MESSAGE_ID);

                throw msg;
            }
        }
    };
    //]]>
</script>

<div class="card">
    <h:form>
        <p:growl showDetail="true"/>

        <h:panelGrid columns="4" cellpadding="7">
            <h:outputLabel for="email1" value="Email 1: (JSF Validation)"/>
            <p:inputText id="email1" value="#{customValidationView.text}">
                <f:validator validatorId="custom.emailValidator"/>
            </p:inputText>
            <p:message for="email1" display="tooltip"/>
            <h:outputText value="#{customValidationView.text}"/>

            <h:outputLabel for="email2" value="Email 2: (Bean Validation)"/>
            <p:inputText id="email2" value="#{customValidationView.email}"/>
            <p:message for="email2" display="tooltip"/>
            <h:outputText value="#{customValidationView.email}"/>
        </h:panelGrid>
        
        <p:commandButton value="Save" ajax="false" icon="pi pi-check" validateClient="true" styleClass="p-mt-3" />
    </h:form>
</div>