• 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

DefaultCommand Multiple

DefaultCommand controls which command to initiate form submit with when enter key is pressed. Multiple defaultCommand in same form is supported with scope option. Within a Textarea the defaultCommand 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.
widgetVar String false generated ('widget_' + componentClientId) Name of the client side widget.
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...
Tag DocumentationNew DocumentationNew Documentation JSDoc Basic Multiple
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">
            <h:panelGrid columns="2" cellpadding="7">
                <h:outputLabel for="name" value="Name"/>
                <p:inputText id="name" value="#{defaultCommandView.text}"/>

                <h:outputLabel for="textarea" value="Textarea"/>
                <p:inputTextarea id="textarea" value="#{defaultCommandView.text2}"/>
            </h:panelGrid>
        </p:panel>

        <p:panel header="Panel 2" id="panel2" styleClass="mb-5">
            <h:panelGrid columns="2" cellpadding="7">
                <h:outputLabel for="otherInput" value="Other input"/>
                <p:inputText id="otherInput"/>
            </h:panelGrid>
        </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>