Announcement

Collapse
No announcement yet.

default button in form

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

  • default button in form

    May be I just have not foundt it yet, but is it possible to give a button, for example "Insert" or "OK", the default functionality on pressing the ENTER key on the keyboard?
    Something like the submit button in a normal HTML form.

    Best regards

    Eric

  • #2
    Re: default button in form

    I have asked for this in a support ticket. Hopefully this will be included in V5.

    Regards,
    Scott.

    Comment


    • #3
      Re: default button in form

      Ah, ok. I thought it would be in, as it is on the login screen of SC yet ^^.

      Lets wait and hope, would make event handling in forms easier.

      Best regards

      Eric

      Comment


      • #4
        Re: default button in form

        Scott,
        Did you find this feature in V5..?

        Dhana

        Comment


        • #5
          Re: default button in form

          Not yet.. I opened another ticket.. and sent this in a big BUG list to bugs@scriptcase.net

          Regards,
          Scott.

          Comment


          • #6
            Re: default button in form

            Hi, I have made quick workaround for this missing feature:
            In your control application go to "Javascript", choose "Form" -> "onLoad" event and edit it to:
            Code:
            function submitenter(myfield,e)
            {
            var keycode;
            if (window.event) keycode = window.event.keyCode;
            else if (e) keycode = e.which;
            else return true;
            
            if (keycode == 13)
            {
            document.F1.submit();
            return false;
            }
            else
            return true;
            };
            
            document.F1.username.onkeypress=submitenter;
            document.F1.password.onkeypress=submitenter;
            Where "username" and "password" of course are names of your form fields.

            Comment


            • #7
              Re: default button in form

              I gave it a try, nothing happens.

              -JS/onLoad
              -entered code
              -changed fieldnames
              -run

              No action on ENTER

              Regards,
              Scott.

              Comment


              • #8
                Re: default button in form

                Here is a little variation that worked for me:

                Code:
                function submitenter(e) {
                 var keycode;
                 if (window.event) keycode = window.event.keyCode; // IE
                 else keycode = e.which; // FF
                
                 if (keycode == 13) {
                  document.F1.submit();
                  return false;
                 } else return true;
                }
                
                document.F1.input_username.onkeypress=submitenter;
                document.F1.input_password.onkeypress=submitenter;
                Regards,
                Scott.

                Comment


                • #9
                  Re: default button in form

                  O! Ty Scott for fixing error in that JavaScript (my bad that I didn't test that code with FF).

                  Comment


                  • #10
                    Re: default button in form

                    Thanks it works

                    Comment

                    Working...
                    X