You need to sign in to do that
Don't have an account?
Mikko4
Blur inputField on page load
Hi!
You know that first inputField on the page gets focus on page load? So when the first inputField is a date field then the date picker annoyingly pops up automatically. Does anyone know a way to prevent this?
Thanks!
Add that to the bottom of your page in question before the </apex:page> tag and it will prevent Salesforce from giving the DatePicker the focus. (Of course it doesn't leave the focus anywhere useful, so you could fix that yourself if you wanted to... I typically leave it hanging and let the user decide where to start.)
This is, of course, a total hack which could break if Salesforce were to change this code... a more canonical way would be to select one of your elements which isn't the datepicker and set the focus to that instead. But this works well and the datepicker never gets the focus in the first place.
I suspect someone may have a more proper solution out there on the boards somewhere...
Best, Steve.
All Answers
Add that to the bottom of your page in question before the </apex:page> tag and it will prevent Salesforce from giving the DatePicker the focus. (Of course it doesn't leave the focus anywhere useful, so you could fix that yourself if you wanted to... I typically leave it hanging and let the user decide where to start.)
This is, of course, a total hack which could break if Salesforce were to change this code... a more canonical way would be to select one of your elements which isn't the datepicker and set the focus to that instead. But this works well and the datepicker never gets the focus in the first place.
I suspect someone may have a more proper solution out there on the boards somewhere...
Best, Steve.
That's perfect! Thanks Steve!
My page only has this one date field and then a dataTable so this solution works well for me.