Skip to main content

Posts

Showing posts with the label adf auto focus fragment jsff

Auto Focus in ADF : Revisit

Auto focus on the first or name field of a jsff is difficult if it is loaded dynamically. Here is one solution: 1) In your page or template add the following non visible text fields near the end of your page(these will set the client id of your field and execute some javascript): <af:inputText clientComponent="true" id="hit7" value="#{formBean.focusId}" visible="false"/> <inputText clientComponent="true" id="hit8" value="#{formBean.focusScript}" visible="false"/> 2) Backing bean (MUST use view scope): //member variables private boolean mustExecuteAutoFocus = false; private String clientFocusId = null; //Constructor - this will be called when the taskflow id changes in the region public FormBean(){ mustExecuteAutoFocus = true; } public String getFocusId(){ //here you can use a bound component or find a component in the view root by id etc to get your id or just hard code it ...