A question on the OTN forum has been how to highlight the content of an input field when navigation to it occurs using the auto tab functionality. As a reminder, the "autotab" property of an input field, if set to "true", tabs out of the field that you currently edit when the maximum length of the field entry is reached.
<f:view xmlns:f="http://java.sun.com/jsf/core" xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
<af:document title="AutoTab.jsf" id="d1">
var textfield =
<af:inputText label="First Name" id="it1"
<af:inputText label="Last Name" id="it2"
<af:clientListener method="onFocusHandler" type="focus"/>
IDs are rendered at runtime in ADF Faces. If component rendering changes in a future
release (you never know) then your code will break at this point and
needs to be corrected. So heads-up on this risk (though should be a
small one). To the time of writing this lines there is no other API (option) available to get to the HTML field handle in ADF Faces.
Also note the use of
AdfAgent.AGENT.getElementById, which is a performant wrapper API in ADF Faces around the document.findElementById function of the Browser DOM. As a rule of thumb you should always work with ADF Faces JS APIs and don't directly reach out to the DOM yourself.