Forum Index

No notifications
Notifications

Favorites

No favorites found
Ask the community Need help to achieve something? - Ask the Community
Subscribe to post
User avatar
Din TIR - (25/04/2017 10:14:39)
RE:Enter key issue

Hi Matt,

Thanks for clarifiying the issues.

Here is the script I use to for both MaskPassword and DataSourceGrid Textbox.

function EndRequestHandler(sender, args) {
    if (args.get_error() == undefined) {
        SetClientBindings();
    }                   
}

function SetClientBindings() {    
    $(".kk_MaskPassword_OnEnterOverride input").keypress(function(e) {
        /* on enter key press */
        if (e.keyCode == 13) {
            e.preventDefault();
            
            if($(".kk_MaskPassword_OnEnterButtonSubmit")[0]) {
                $('.kk_MaskPassword_OnEnterButtonSubmit input[type="submit"]:nth-child(1)').trigger('click');
            }
        }
    });
    
    $(".kk_DS_Textbox_OnEnterOverride input[type='text']").keypress(function(e) {
        /* on enter key press */
        if (e.keyCode == 13) {
            e.preventDefault();
            
            if($(".kk_DS_Textbox_OnEnterButtonSubmit")[0]) {
                $('.kk_DS_Textbox_OnEnterButtonSubmit input[type="submit"]:nth-child(1)').trigger('click');
            }
        }
    });
}

$(document).ready(function() {
    var prm = Sys.WebForms.PageRequestManager.getInstance();
    prm.add_endRequest(EndRequestHandler);
    SetClientBindings();
});

  • To stop the MaskPassword to submit on enter key, I just need to add the style class "kk_MaskPassword_OnEnterOverride" to the FreeText.
  • To stop the DataSourceGrid Textbox to submit on enter key, I just need to add the style class "kk_DS_Textbox_OnEnterOverride" to the DataSourceGrid.
  • There are also addon style class, when the enter key is press for MaskPassword and DataSourceGrid Textbox, we can indicated a button to submit by adding the style class "kk_MaskPassword_OnEnterButtonSubmit" or "kk_DS_Textbox_OnEnterButtonSubmit" to the Button submitting respectively.

 

RSS Feed