Activity Forums Salesforce® Discussions Vf Page Is The Datepicker.

  • Vf Page Is The Datepicker.

    Posted by Aman on September 20, 2018 at 2:57 pm

    Let’s Consider That The First Component In Vf Page Is The Datepicker. In That Case Whenever The Page Loads, Salesforce Auto Focus The First Component Resulting In Datepicker Onfocus Event. Because Of This The Datepicker Component Opens Automatically. How We Can Avoid This?

    Parul replied 4 years ago 3 Members · 2 Replies
  • 2 Replies
  • shariq

    September 20, 2018 at 2:59 pm


    On load event, write the javascript code to autofocus any other field or any other non-visible component.

    Example :

    <span id="focusDistraction"></span>

    <script type="text/javascript">

    /* prevent autopup of the date inputfield by the default focus behavoir */

    window.onload=function() {





  • Parul

    September 20, 2018 at 4:50 pm

    If you are using Lightning then you can use javascript in your lightning bundle in a js file. In init function of the component to remove the autofocus.




Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos