I want to set focus on inputText field in JSF on page load. How can I implement this?
+1
A:
You can use JavaScript for this. Every input element has a focus() function.
If you want to focus the 1st input element of the 1st form during window load, then do:
window.onload = function() {
document.forms[0].elements[0].focus();
}
If you want to focus a specific input element during window load, then do:
window.onload = function() {
document.getElementById('formId:inputId').focus();
}
See also:
BalusC
2010-06-29 11:11:43