我想添加按下超過250個字符時觸發的keydown事件。這裏是代碼,如何在Ext.Message.Box中使用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個字符。
你想通知用戶還是隻是不允許他進入? –
我想通知用戶。 –