Locale

Language
English
English
English
French
German
German
Italian
Korean
Spanish
Catalan
Dutch
Portuguese
Portuguese
Arabic
Arabic
Bulgarian
Czech
Greek
Persian
Finnish
Danish
Hindi
Indonesian
Croatian
Japanese
Hungarian
Hebrew
Georgian
Central Kurdish
Khmer
Kyrgyz
Kazakh
Lithuanian
Latvian
Malay
Norwegian
Polish
Romanian
Russian
Slovak
Slovenian
Serbian
Swedish
Thai
Turkish
Ukrainian
Vietnamese
Chinese
Chinese

Input Style

Free Themes

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

Saga Saga
Vela Vela
Arya Arya

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

Client Side Validation Immediate

Immediate client side validation - like used from modern JS-based-UI-Frameworks like React, Angular or Vue - on all input-components (triggered by keyup- respectively change-events depending on component) and CommandButton only enabled after successful CSV of all input-components relevant due to process-attribute.

Simulate server-side modifications:

<style type="text/css">
    body .ui-panelgrid .ui-panelgrid-cell {
        padding: 0.5rem;
    }

    button.ui-state-csv-valid, input.ui-state-csv-valid, .ui-inputfield.ui-state-csv-valid, .ui-selectonemenu.ui-state-csv-valid {
        border-left-color: green !important; /* !important to override border-color set by ui-state-focus */
        border-left-style: solid;
        border-left-width: 5px;
    }

    button.ui-state-csv-invalid, input.ui-state-csv-invalid, .ui-inputfield.ui-state-csv-invalid, .ui-selectonemenu.ui-state-csv-invalid {
        border-left-color: red !important; /* !important to override border-color set by ui-state-focus */
        border-left-style: solid;
        border-left-width: 5px;
    }
</style>

<div class="card">
    <h:form>
        <p:messages>
            <p:autoUpdate/>
        </p:messages>

        <p:panelGrid id="gridName" columns="4" layout="flex"
                     columnClasses="col-12 xl:col-3, col-12 xl:col-2, col-12 xl:col-5, col-12 xl:col-2"
                     contentStyleClass="align-items-baseline ui-fluid">
            <p:outputLabel for="name" value="Name (3-50 characters):"/>
            <p:inputText id="name" value="#{validationView.text}" required="true" label="Name">
                <f:validateLength minimum="3" maximum="50"/>
                <p:clientValidator event="keyup" />
            </p:inputText>
            <p:message for="name"/>
            <h:outputText value="#{validationView.text}"/>
        </p:panelGrid>

        <p:panelGrid id="gridNumber" columns="4" layout="flex"
                     columnClasses="col-12 xl:col-3, col-12 xl:col-2, col-12 xl:col-5, col-12 xl:col-2"
                     contentStyleClass="align-items-baseline ui-fluid">
            <p:outputLabel for="number" value="Number:"/>
            <p:inputNumber id="number" value="#{validationView.integer}" label="Number"
                            validateMask="false" required="true">
                <f:validateLongRange minimum="100" maximum="9999" />
                <p:clientValidator event="keyup" />
            </p:inputNumber>
            <p:message for="number"/>
            <h:outputText value="#{validationView.integer}"/>
        </p:panelGrid>

        <p:panelGrid id="gridEverythingElse" columns="4" layout="flex"
                     columnClasses="col-12 xl:col-3, col-12 xl:col-2, col-12 xl:col-5, col-12 xl:col-2"
                     contentStyleClass="align-items-baseline ui-fluid">
            <p:outputLabel for="dd" value="Double (5.5 - 8.5):"/>
            <p:inputText id="dd" value="#{validationView.doubleNumber}"
                            converterMessage="Cannot convert to double." required="true">
                <f:validateDoubleRange minimum="5.5" maximum="8.5"/>
                <p:clientValidator event="keyup" />
            </p:inputText>
            <p:message for="dd"/>
            <h:outputText value="#{validationView.doubleNumber}"/>


            <p:outputLabel for="regex" value="Regex (^[a-zA-Z]+$):"/>
            <p:inputText id="regex" value="#{validationView.regexText}"
                            validatorMessage="Value does not match pattern." required="true">
                <f:validateRegex pattern="^[a-zA-Z]+$"/>
                <p:clientValidator event="keyup" />
            </p:inputText>
            <p:message for="regex"/>
            <h:outputText value="#{validationView.regexText}"/>

            <p:outputLabel for="localDate" value="LocalDate (Java8; PF DatePicker)"/>
            <p:datePicker id="localDate" value="#{validationView.localDate}" pattern="MM/dd/yyyy"
                            label="LocalDate (DatePicker)" required="true">
                <p:clientValidator />
            </p:datePicker>
            <p:message for="localDate"/>
            <h:outputText value="#{validationView.localDate}">
                <f:convertDateTime pattern="MM/dd/yyyy" type="localDate"/>
            </h:outputText>

            <p:outputLabel for="@next" value="Select UI-library" />
            <p:selectOneMenu id="selectOneMenu" value="#{validationView.uiLibrary}" required="true">
                <f:selectItem itemLabel="" itemValue="" noSelectionOption="true" />
                <f:selectItem itemLabel="JSF" itemValue="JSF" />
                <f:selectItem itemLabel="Angular" itemValue="Angular" />
                <f:selectItem itemLabel="React" itemValue="React" />
                <f:selectItem itemLabel="Vue" itemValue="Vue" />
                <p:clientValidator />
            </p:selectOneMenu>
            <p:message for="selectOneMenu"/>
            <h:outputText value="#{validationView.uiLibrary}"/>
        </p:panelGrid>

        <p:remoteCommand name="rc" update="gridName gridNumber" process="name number" validateClient="true"/>
        <p:defaultCommand target="btnAjax"/>

        <div class="pt-3">
            <p:commandButton value="Non-Ajax" ajax="false" validateClient="true" enabledByValidateClient="true" styleClass="mr-2" />
            <p:commandButton value="Ajax" id="btnAjax" update="@form" validateClient="true" enabledByValidateClient="true" styleClass="mr-2" />
            <p:commandButton value="Partial (name + number)" update="gridName gridNumber" process="name number" validateClient="true" enabledByValidateClient="true" styleClass="mr-2" />
            <p:commandButton value="Disabled" ajax="false" enabledByValidateClient="true" styleClass="mr-2"/>
            <p:commandButton value="Remote Command" type="button" enabledByValidateClient="true" onclick="rc()" />
        </div>

        <div class="pt-3">
            Simulate server-side modifications:<br/>
            <p:commandButton value="Modify Name + Number" update="gridName gridNumber" process="@this" action="#{validationView.modifyValues()}" styleClass="mr-2" />
            <p:commandButton value="Modify Number" update="gridNumber" process="@this" action="#{validationView.modifyInteger()}" styleClass="mr-2" />
            <p:commandButton value="Clear Values" update="@form" process="@this" action="#{validationView.clearValues()}" />
        </div>
        
    </h:form>
</div>