【发布时间】:2017-02-03 09:00:29
【问题描述】:
我想添加当我按下超过 250 个字符时触发的 keydown 事件。这是代码,
var c = Ext.MessageBox.show({
title: "Version Remarks",
id:'test',
inputType: "textareafield",
msg:"Please Enter Version Remarks: (Only 250 Character)",
width: 375,
buttons: Ext.MessageBox.OKCANCEL,
multiline: true,
label: Ext.MessageBox.label,
fn: b,
icon: Ext.MessageBox.INFO,
modal: true,
closable: false,
allowBlank: false,
});
c.textArea.on('change', function (e, text, o) {
if (text.length > 250) {
c.msgButtons.ok.setDisabled(true);
//c.label.setText("This is the label");
alert("You are not able to enter more than 250 Character.!!")
} else {
c.msgButtons.ok.setDisabled(false);
}
}
当我按下 251 个字符时,会显示弹出窗口,并允许我输入字符,但现在我想使用 onkeydown 事件,它不允许用户输入超过 250 个字符的任何字符。
【问题讨论】:
-
您要通知用户还是不允许他进入?
-
我要通知用户。
标签: javascript extjs sencha-touch