Saturday, 22 February 2014

Avoid focus on date field

When will focus come to date field on a visualforce page load?
If the first field is the date field then whenever user try to open the visualforce page focus will be on date field.
Note: If you have pick list field as the first field then focus won't be on that field. Example if you have two pick list fields followed by date field then focus will be on date field not on pick list fields.

What to do?
Add below line of code to your visualforce page.
<script>function setFocusOnLoad() {}</script>

2 comments: