extjs - 我需要在警报框消息中写入名字,例如如果我输入名字杰克,那么警报会像杰克登录成功一样出现
问题描述
我需要在警报框消息中写入名字,例如如果我输入名字杰克,那么警报会像杰克登录成功一样出现。
defaultType: 'textfield',
items: [{
fieldLabel: 'First Name',
itemId:'fname',
name: 'first',
allowBlank: false
},{
fieldLabel: 'Last Name',
name: 'last',
allowBlank: false
},{
fieldLabel: 'User Name',
name: 'uName',
allowBlank: false,
emptyText:'User Id'
},{
fieldLabel: 'Password',
name: 'passWd',
allowBlank: false,
inputType:'Password'
}],
// Reset and Submit buttons
buttons: [{
text: 'Reset',
handler: function() {
this.up('form').getForm().reset();
}
}, {
text: 'Login',
formBind: true, //only enabled once the form is valid
listeners: {
click: function() {
Ext.Msg.alert('Login Successfully');
}
解决方案
看看这个小提琴
代码片段:
{
text: 'Login',
formBind: true, //only enabled once the form is valid
listeners: {
click: function () {
var fname = this.up('form').down('#fname').getValue();
Ext.Msg.alert('Success!', fname + ' login successfully');
}
}
}
推荐阅读
- accessibility - 如何让 VoiceOver 将此警报宣布为 NVDA?
- javascript - 将 Web 链接添加到 FCM 推送通知 Web
- python - 使用 Pandas.Melt 重新排列 Pandas 数据框以一次获取多列?
- powershell - 在使用 NoProfile 参数运行 Powershell 时尝试删除别名不起作用
- git - 在 Windows 上找不到 git-upload-pack 命令
- python - 如何从 Heroku 获取 Postgresql 配置参数?
- sql - 我写了程序,只填了一栏,告诉我错误在哪里?
- windows - 如何使用 wGet 获取文件而不是 url
- laravel - 如何在 laravel eloquent 查询中使用数学函数?
- reactjs - 无法读取未定义的属性“问题”