Visualforce Page: How to remove focus / selection from first input field

4:22 PM

References:
Just took this solution from the above mentioned posts, summarizing below

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

  1. 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

Stats