How to set the initial component focus
- by frank.nimphius
Normal
0
false
false
false
EN-US
X-NONE
X-NONE
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-qformat:yes;
mso-style-parent:"";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin:0in;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;}
In ADF Faces, you use the af:document tag's initialFocusId to define the initial component focus. For this,
specify the id property value of the
component that you want to put the initial focus on. Identifiers are relative
to the component, and must account for NamingContainers. You can use a single
colon to start the search from the root, or multiple colons to move up through
the NamingContainers - "::" will pop out of the component's naming
container and begin the search from there, ":::" will pop out of two
naming containers and begin the search from there. Alternatively you can add
the naming container IDs as a prefix to the component Id, e.g. nc1:nc2:comp1.
http://download.oracle.com/docs/cd/E17904_01/apirefs.1111/e12419/tagdoc/af_document.html
To set the initial focus to a component located in a page
fragment that is exposed through an ADF region, keep in mind that ADF Faces
regions - af:region
- is a naming container too. To address an input text field with the id "it1" in an ADF region
exposed by an af:region
tag with the id r1, you use the
following reference in af:document:
<af:document
id="d1" initialFocusId="r1:0:it1">
Note the "0" index in the client Id. Also, make
sure the input text component has its clientComponent
property set to true as otherwise no
client component exist to put focus on.