• 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

Focus

Focus manages element focus in forms. By default first visible and enabled input element(e.g. text, textarea, select) is chosen to receive focus automatically. It is also possible to explicitly declare the component to receive focus via the for attribute. Focus is also aware of failed validations, first invalid input component receives a focus automatically.

Focus Tag Documentation

Focus is a handy component that makes it easy to manage the element focus on a Faces page.

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.
context String false Search expression for the context/search area to find the focusable component.
for String false Search expression for the component to receive focus.
minSeverity String false error Minimum severity level to be used when finding the first invalid component.
Loading...
Tag DocumentationNew DocumentationNew Documentation

Usage


<div class="card">
    <h:form>
        <p:focus context="panel"/>

        <p:messages/>

        <h:panelGrid id="panel" columns="3" cellpadding="7">
            <p:outputLabel for="username" value="Username"/>
            <p:inputText id="username" value="#{focusView.username}" required="true" label="Firstname">
                <f:validateLength minimum="2"/>
            </p:inputText>
            <p:message for="username"/>

            <p:outputLabel for="email" value="Email"/>
            <p:inputText id="email" value="#{focusView.email}" required="true" label="Surname"/>
            <p:message for="email"/>
        </h:panelGrid>

        <p:commandButton id="submitButton" value="Save" update="@parent" action="#{focusView.save}" styleClass="mt-3" />
    </h:form>
</div>