Activity Forums Salesforce® Discussions How to Remove Enter Functionality from InputFields in a Salesforce Visualforce Page?

  • How to Remove Enter Functionality from InputFields in a Salesforce Visualforce Page?

  • PRANAV

    Member
    April 26, 2018 at 4:36 pm

    I want to Remove Enter Functionality from InputFields in a Visualforce Page. Please help me out.

  • Manpreet

    Member
    April 26, 2018 at 4:38 pm

    Hi pranav,

    Add the following script to your Visualforce Page:

    <script type='text/javascript'>
    function stopRKey(evt)
    {
    var evt=(evt) ? evt : ((event) ? event : null);
    var node=(evt.target)?evt.target:((evt.srcElement)?evt.srcElement:null);
    if ((evt.keyCode == 13) && (node.type=="text")) {return false;}
    }

    document.onkeypress = stopRKey;
    </script>

    Thanks.

  • Aman

    Member
    April 26, 2018 at 8:45 pm

    Hi Pranav,

    I have tried the below java script code in all the input fields and Command Button to avoid Enter functionality while creating the opportunity in my own visual force page.It is working very well for me.

    onkeydown="if(event.keyCode==13){this.blur();actionFunction();}"

Viewing 1 - 3 of 3 posts

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos