Announcement

Collapse
No announcement yet.

Make the enter key execute a custom button

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Make the enter key execute a custom button

    Often I do not use the standard "submit" button on forms.

    For instance, sometimes I want a PHP button or a JScript button to be the "default" button.

    Unfortunately, in the Form Settings, the "Use Enter To" only allows "submit" or "tab".

    To make your button execute when enter is pressed, create a JavaScript entry for "Form->onLoad" and plug this in:

    $(document).keypress(function(e) {
    if (e.which == "13") {
    sc_btn_my_button();
    }
    });


    of course, substitute the name of your actual button in place of my_button.

    Now, hitting the enter key is the same as clicking that button.

    Dave
    Last edited by daveprue; 11-04-2014, 07:27 AM.
    Dave Prue
    Code Whisperer
    Lahar International Corp
    www.lahar.net
Working...
X