X

The blog for hints & tips about Oracle Application Development Framework and Mobile Application Framework

  • ADFv |
    January 31, 2011

How to set the initial component focus

Frank Nimphius
Master Principal Product Manager

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.

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha
Oracle

Integrated Cloud Applications & Platform Services