Activity Forums Salesforce® Discussions Datepicker component opens automatically - how can we avoid this in Salesforce?

  • shariq

    Member
    September 22, 2018 at 10:02 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() {
    document.getElementById('focusDistraction').focus();
    }
    </script>

  • Parul

    Member
    September 23, 2018 at 4:20 am

    Example :

    <span id=”focusDistraction”></span>

    <script type=”text/javascript”>

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

    window.onload=function() {

    document.getElementById(‘focusDistraction’).focus();

    }

    </script>

     

    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