• 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.

                        
                    

DefaultCommand Multiple

DefaultCommand controls which command submits the form when Enter is pressed in an input. Multiple default commands in one form are supported with scope, which refers to an ancestor of the inputs a command is responsible for: Enter triggers Button1 in Panel 1 and Button2 in Panel 2. Within a textarea the default command is not active.

DefaultCommand Tag Documentation

DefaultCommand defines the default command component to invoke when enter key is pressed in a form.

NameTypeRequiredDefaultDescription
id String false generated Unique identifier of the component in a namingContainer.
rendered boolean false true Boolean value to specify the rendering of the component, when set to false component will not be rendered.
binding UIComponent false generated An EL expression referring to a server side UIComponent instance in a backing bean.
ref String false generated ('pf_' + componentClientId) Name of the client side component, e.g. to access it via PF('name').
widgetVar String false Deprecated, use ref instead. Name of the client side component.
scope String false Identifier of the grouping component to enable multiple default commands in a form.
target String true Identifier of the default command component.
Loading...
Panel 1
Panel 2

Usage


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

        <p:panel header="Panel 1" id="panel1" styleClass="mb-5">
            <div class="formgrid grid p-fluid">
                <div class="field col-12 md:col-6">
                    <h:outputLabel for="name" value="Name"/>
                    <p:inputText id="name" value="#{defaultCommandView.text}"/>
                </div>
                <div class="field col-12 md:col-6">
                    <h:outputLabel for="textarea" value="Textarea"/>
                    <p:inputTextarea id="textarea" value="#{defaultCommandView.text2}"/>
                </div>
            </div>
        </p:panel>

        <p:panel header="Panel 2" id="panel2" styleClass="mb-5">
            <div class="formgrid grid p-fluid">
                <div class="field col-12 md:col-6">
                    <h:outputLabel for="otherInput" value="Other input"/>
                    <p:inputText id="otherInput"/>
                </div>
            </div>
        </p:panel>

        <p:commandButton value="Button1" id="btn1" action="#{defaultCommandView.btn1Submit}" styleClass="mr-2" />
        <p:commandButton value="Button2" id="btn2" action="#{defaultCommandView.btn2Submit}"/>

        <p:defaultCommand target="btn1" scope="panel1"/>
        <p:defaultCommand target="btn2" scope="panel2"/>
    </h:form>
</div>