locked
Server side Submit button RRS feed

  • Question

  • User-1355356054 posted

    I have several buttons on my form (it is a Telerik TabStrip control) that needs to do a server side postback when the user has focus on one of the buttons. It is a heavy data entry form and they require no mouse clicks. Strictly tabing to each field and then when the user tabs to one of the buttons and hits <ENTER> on the keyboard, I need to do a server side postback. I can't assign the <ENTER> key to a button, because I have multiple buttons on the form to do other things like look ups, etc, besides submitting the form.

    Any ideas on how this can be accomplished? 

    Tuesday, September 21, 2010 7:52 PM

All replies

  • User614805505 posted

    Dear,

    <form runat="server" defaultbutton="btnSubmit">

    Set the defaultbutton at the "form" element will solve your  problem.

    Tuesday, September 21, 2010 8:55 PM
  • User-1355356054 posted

    This won't do it, because I have several buttons on the same form (btnSubmit, btnVoid, btnPend, btnDef, & 3 search buttons with different names). 

    I need a way that when focus is on a particular button & the user presses <ENTER>, a server-side postback will occur for that button.

    Wednesday, September 22, 2010 10:26 AM
  • User614805505 posted

    Dear, 

    You can choose to use jQuery. 

    http://api.jquery.com/keyup/

    $('#target').keyup(function(event) {
      if (event.keyCode == '13') {
         event.preventDefault();
       }
       xTriggered++;
       var msg = 'Handler for .keyup() called ' + xTriggered + ' time(s).';
      $.print(msg, 'html');
      $.print(event);
    });


    Handle the keyup event, 

    http://api.jquery.com/focus/

    $('#target').focus(function() {
      alert('Handler for .focus() called.');
    });



    Fire the focus method.

    Wednesday, September 22, 2010 9:31 PM