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

DefaultCommand controls which command to initiate form submit with when enter key is pressed. Example below demonstrates 3 types of buttons; non-ajax, ajax and standard.

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

Usage


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

        <h:panelGrid columns="2" cellpadding="7" styleClass="mb-3">
            <h:outputLabel for="btnSelect" value="Default Button:"/>
            <p:selectOneMenu id="btnSelect" value="#{defaultCommandView.btn}" onchange="$('#form').submit()">
                <f:selectItems value="#{defaultCommandView.buttons}"/>
            </p:selectOneMenu>

            <h:outputLabel for="name" value="Name:" />
            <p:inputText id="name" value="#{defaultCommandView.text}"/>
        </h:panelGrid>

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

        <p:defaultCommand target="#{defaultCommandView.btn}"/>
    </h:form>
</div>