Hi,
We can use this approach for now, but this is only if there is one password field on the form, but we can change it to all fields and optimize
function afterrender(sender, eOpts) {
Ext.DomHelper.insertAfter(
sender.triggerWrap, {
id: 'capslock_td',
tag: 'span',
html: '<i class="fa fa-warning">CapsLock ON!</i>'
},
true);
capslock_td.hidden = true;
Ext.onReady(function() {
function _capsLockDetect(e) {
if (!e) e = window.event || null;
if (typeof(oncapslock) != "function" || !e) return;
var n = e.keyCode ? e.keyCode : e.charCode;
if (e.type == "keypress") {
var c = String.fromCharCode(n);
var cUC = c.toUpperCase();
var cLC = c.toLowerCase();
if (cUC != cLC) oncapslock((e.shiftKey && cLC == c) || (!e.shiftKey && cUC == c));
} else if (e.type == "keydown" && n == 20) oncapslock(false);
}
if (document.addEventListener) {
document.addEventListener("keypress", _capsLockDetect, false);
document.addEventListener("keydown", _capsLockDetect, false);
} else if (document.attachEvent) {
document.attachEvent("onkeypress", _capsLockDetect);
document.attachEvent("onkeydown", _capsLockDetect);
} else document.onkeypress = document.onkeydown = _capsLockDetect;
window.oncapslock = function(on) {
Ext.get("capslock_td").dom.hidden = !on
}
});
}
Best regards,