Visualforce Page: How to remove focus / selection from first input field
4:22 PM
References:
Problem:
When a Visualforce Page loads, the date input field is selected by default. The usual behavior is that the first input field or box in the page is focussed by default. Clearly annoying in this case
Solution:
Add the below piece of code in your visualforce page.
Tried the other option suggested, but it does NOT work for me.
- http://boards.developerforce.com/t5/Visualforce-Development/How-to-remove-focus-from-first-input-field/td-p/105445
- http://boards.developerforce.com/t5/Visualforce-Development/inputField-Calendar-Widget/m-p/71094#M1050
Problem:
When a Visualforce Page loads, the date input field is selected by default. The usual behavior is that the first input field or box in the page is focussed by default. Clearly annoying in this case
Solution:
Add the below piece of code in your visualforce page.
<script>
function setFocusOnLoad() {}
</script>
Tried the other option suggested, but it does NOT work for me.
<script>beenfocused = true; </script>
1 comments
great tip. I had many widgets on my dashboard and every widget contained first field as date field. So onload my page was cluttered with date pickers. sigh. When is salesforce gonna make developers' lives easy?
ReplyDelete