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();
Ext.MessageBox.show({
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);
page revision: 1, last edited: 12 Jun 2018 18:14