Monday, April 30, 2012

ADF: Default cursor/focus to input field & default button of JSF page


For setting initial cursor/focus to input field:
  • The property named "initialFocusId" should be set of <af:document>.
  • The property named " clientComponent" should be set to "true" for that input field.

For setting default button for the form:
  • The property named "defaultCommand" of "<af:form>" should be set. By setting this property, we can press "Enter" & the button's action will be invoked.
    <af:document id="d1" initialFocusId="it1">
      <af:form id="f1" defaultCommand="cb1">
        <af:panelStretchLayout id="psl1">
          <f:facet name="center">
            <af:panelGroupLayout layout="scroll" id="pgl1">
              <af:inputText label="Label 1" id="it1" clientComponent="true"/>
              <af:inputText label="Label 2" id="it2"/>
              <af:commandButton text="commandButton 1" id="cb1"/>
            </af:panelGroupLayout>
            <!-- id="af_one_column_stretched"   -->
          </f:facet>
        </af:panelStretchLayout>
      </af:form>
    </af:document>
Note: For jsff pages, we can use <af:subform>.
<af:subform defaultcommand="cb1" id="s1" />

No comments:

Post a Comment