You need to sign in to do that
Don't have an account?
Rajesh Shah
date field in focus on edit page
I have a standard Salesforce edit page where the first 2 fields are picklist and the next one is a date field. Everytime the page loads in edit mode, salesforce automatically brings the date field in focus and the calendar widget pops up. This can be very confusing to the users as the date field is required to be populated only in certain cases. I also do not have the option of moving a text field before the date field.
Is there a way to remove the focus or allow me to have some other field in focus?
If you were to override the standard Edit view with a VisualForce page, there may be a solution...
After building the VF page with the preferred layout, add an window.onload event to set the focus to the field of your choice- something like this:
<script type="text/javascript"> window.onload = setFocus function setFocus() { document.getElementById("{!$Component.myForm.pgBlock.pgBsec.myfield}").focus(); } </script>
All Answers
Really? I just tried this and I moved the date field below a couple of other fields using the page layout editor and it wasn't in focus anymore. The calendar only popped up once I clicked or tabbed over to the date field.
Best,
Sati
Well, it might be because of the picklist fields -- they might not receive focus normally like an edit box does.
If you were to override the standard Edit view with a VisualForce page, there may be a solution...
After building the VF page with the preferred layout, add an window.onload event to set the focus to the field of your choice- something like this:
<script type="text/javascript"> window.onload = setFocus function setFocus() { document.getElementById("{!$Component.myForm.pgBlock.pgBsec.myfield}").focus(); } </script>
..is a good solution.