• Settings
    • Locale
    • Change the locale of the datepicker, schedule and client side validation messages.

      Language
      English
      English
      English
      French
      German
      German
      German
      Italian
      Korean
      Spanish
      Catalan
      Dutch
      Portuguese
      Portuguese
      Arabic
      Arabic
      Bulgarian
      Bangla
      Bosnian
      Czech
      Greek
      Estonian
      Persian
      Finnish
      Danish
      Hindi
      Indonesian
      Icelandic
      Croatian
      Japanese
      Hungarian
      Hebrew
      Georgian
      Central Kurdish
      Khmer
      Kyrgyz
      Kazakh
      Lithuanian
      Latvian
      Malay
      Norwegian
      Polish
      Romanian
      Russian
      Slovak
      Slovenian
      Serbian
      Serbian
      Swedish
      Thai
      Turkish
      Ukrainian
      Uzbek
      Vietnamese
      Chinese
      Chinese
  • Resources
Theme
Theme
Preset primefaces.THEME
Apple Liquid Glass style: translucent overlays, menus and bars that blur the page behind them, capsule buttons.
Color scheme color-scheme
Input style p-input-filled
Density data-p-density
Direction primefaces.DIR
Colors
Primary --p-primary-base
Surface --p-surface-*
Shape and motion
Button shape --p-button-border-radius
Shadows --p-*-shadow
Animations --p-transition-duration
Ripple --p-ripple-opacity
Border radius --p-border-radius-*
Typography
Focus ring
Form field
CSS
Only the tokens that differ from the preset.

                        
                    

Client Side Validation Complex / Multi-Field

This examples shows how you can implement complex validation on the clide side like conditional validation or "connected" validation over multiple inputs.
If you select "Name required", you have to set content in the "Name" input.

Usage


<script>
    //<![CDATA[
    PrimeFaces.validator['MyComplexValidator'] = {

        validate: function(element) {
            let nameRequiredPf = PF('nameRequired');
            let namePf = PF('name');

            if (nameRequiredPf.isChecked() && namePf.getValue().length === 0) {
                PrimeFaces.validation.ValidationContext.highlight(namePf);
                PrimeFaces.validation.ValidationContext.addMessage(namePf, { summary: 'Validation Error', detail: 'A name is required!' });
            } else {
                PrimeFaces.validation.ValidationContext.unhighlight(namePf);
            }
        }
    };
    //]]>
</script>

<div class="card">
    <h:form id="form">
        <p:outputPanel pt:data-p-val="MyComplexValidator">
            <p:messages showDetail="true">
                <p:autoUpdate/>
            </p:messages>

            <h:panelGroup id="grid" layout="block" styleClass="formgrid grid p-fluid">
                <div class="field col-12 md:col-4">
                    <p:outputLabel for="@next" value="Name required"/>
                    <p:selectBooleanCheckbox id="nameRequired" widgetVar="nameRequired" value="#{complexValidationView.nameRequired}"/>
                    <p:message for="@previous"/>
                </div>
                <div class="field col-12 md:col-4">
                    <p:outputLabel for="@next" value="Name"/>
                    <p:inputText id="name" widgetVar="name" value="#{complexValidationView.name}" label="Name"/>
                    <p:message for="@previous"/>
                </div>
                <div class="field col-12 md:col-4">
                    <p:outputLabel for="@next" value="Accept Terms And Conditions"/>
                    <p:selectBooleanCheckbox id="terms" value="#{complexValidationView.acceptTermnsAndCondition}"/>
                    <p:message for="@previous"/>
                </div>
            </h:panelGroup>

            <p:defaultCommand target="btnAjax"/>

            <p:commandButton value="Non-Ajax" ajax="false" icon="pi pi-check" validateClient="true"
                             action="#{complexValidationView.doNonAjax()}" style="margin-right:10px"/>
            <p:commandButton value="Ajax" id="btnAjax" update="@form" icon="pi pi-check" validateClient="true"
                             action="#{complexValidationView.doAjax()}" style="margin-right:10px"/>
            <p:commandButton value="Disabled (without CSV)" ajax="false" icon="pi pi-check"
                             action="#{complexValidationView.doNonAjaxWithoutCsv()}"  style="margin-right:10px"/>
        </p:outputPanel>
    </h:form>
</div>