Extjs - Detecting and disabling copy and paste


function disablePasteOnPasswordFields(evt,el) {
    var keyCode = evt.getKey();
    if ((evt.ctrlKey) && (keyCode == 86)) {
        evt.stopEvent(); // handle both preventDefault() and stopPropagation();
            title: 'Error', msg: "Please enter your password manually. Copy and paste is not allowed.",
            width: 450, buttons: Ext.MessageBox.OK, icon: Ext.MessageBox.ERROR, closable: false

Ext.get('NEWPASSWORD').on('keydown', disablePasteOnPasswordFields);
Ext.get('CNFRMPASSWORD').on('keydown', disablePasteOnPasswordFields);
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License