You need to sign in to do that
Don't have an account?

How to remove focus from first input field
By default, the focus is set to the first available inputField. In my case, the first input is a date field. Every time I go to the page, the focus is set to that field and the calendar pops up, covering items below it.
How do I remove the auto-focus? screenshot:

How do I remove the auto-focus? screenshot:

In my VF page, the first input field is a checkbox, but the focus on page load is also set to the second input field -- a date field.
Any explanation?
All Answers
Here is a semi-related idea:
http://ideas.salesforce.com/article/show/10089079/Tab_order_or_Visualforce_page
The idea says tab order but really its more like tab direction. Ideally you would be able to set the tabIndex of each input field.
putting
<script>function setFocusOnLoad() {}</script>
in my VF cleared up the problem.
But how is a function with nothing in it preventing focus?
so use at your own risk! </broken record>
a proper way to do this is to explicitly set the focus on the field you wish, using a body onload event handler. Just be sure to avoid stepping on the existing body onload.
here is a proper way to avoid stepping on the onload function used by visualforce
In my VF page, the first input field is a checkbox, but the focus on page load is also set to the second input field -- a date field.
Any explanation?
This trick worked for me too..
Thanks.
This solves the issue.
Thanks,
<script>function setFocusOnLoad() {}</script>
is a perfectly valid solution. If you look at the source of you apex page you'll see:
function bodyOnLoad(){setFocusOnLoad(); ... }
There is a lot of other code in bodyOnLoad(), we simply want to override the functionality of setFocusOnLoad(). In this case we're doing nothing.
Its work, yes
Thank you very much :)
It is working.
function setFocusOnLoad() {} Works :)
The best chosen answer by Admin doesn't answer the question at all.
Why most of the best chosen by admin in this forum doesn't answer the question?