Focus |
||||
Developer’s Guide Home
Installation and Configuration Common Concepts Components Index Border Layout Panel Calendar Chart Command Button Command Link Confirmation Data Table Date Chooser Day Table Drop Down Field Dynamic Image Folding Panel For Each Graphic Text Hint Label Input Text Input Textarea Layered Pane Popup Layer Popup Menu Select Boolean Checkbox Select Many Checkbox Select One Radio Spinner Suggestion Field Tabbed Pane Tab Set Tree Table Two List Selection Window Focus Load Bundle Scroll Position Ajax Framework Validation Framework Tag Reference API Reference |
Specifying Focus ComponentTo add the Focus component to the page, use the <o:focus> tag. When this component is added, focus is saved automatically. It is important that all HTML and JSF tags have their ids specified to store focus between submissions by using the Focus component. The Focus component has a boolean autoSaveFocus attribute. By default, it is set to "true", which means that focus is saved between page submissions. <h:form>
<o:focus autoSaveFocus="true"/>
</h:form>
Specifying Focused Component on Page LoadYou can specify what component should be focused when the page is loaded using the focusedComponentId attribute. In this attribute, you should specify the id of the component to be focused. Note that the Focus component tracks input focus not just for JSF components but for any HTML input elements as well, so as an alternative you can specify id of an HTML element in the focusedComponentId attribute. It is possible to declare the focusedComponentId attribute as a value expression for loading/saving the focused component through a backing bean. The focusedComponentId attribute should be defined in the same way as the for property of the standard HTMLOutputLabel component, and as an addition allows referring HTML elements:
<h:form id="form1"> <o:focus focusedComponentId=":input"/> ... <input id="input" type="text"/> </h:form> If the autoSaveFocus attribute is set to "true", the id of the focused component is saved into the focusedComponentId attribute between page submissions. Tracking Focus For the Entire ApplicationYou can also specify the org.openfaces.autoSaveFocus context attribute in web.xml to "true" (the default is "false"). This attribute causes focus to be saved between form submissions for all application pages. <context-param>
<param-name>org.openfaces.autoSaveFocus</param-name>
<param-value>true</param-value>
</context-param>
|
|||
© 2009 TeamDev Ltd. | ![]() |