ext form load


Ext.onReady(function() {
// alert('hello');
// 使用表单提示
Ext.QuickTips.init();
Ext.form.Field.prototype.msgTarget = "side";
// 定义一个输入表单
var simple = new Ext.FormPanel( {
labelWidth : 40,
baseCls : "x-plain",
defaultType : "textfield",
reader : new Ext.data.JsonReader( {
root : 'user'
}, [ {
name : 'username',
mapping : 'username',
type : 'string'
}, {
name : 'password',
mapping : 'password',
type : 'string'
} ]),
defaults : {
width : 180
},
items : [ {
fieldLabel : " 帐号",
// name:"user.username",
name : 'username',

allowBlank : false,
blankText : " 帐号不能为空"
}, {
inputType : "password",
fieldLabel : " 密码",
// name:"user.password",
name : 'password',

allowBlank : false,
blankText : " 密码不能为空"
} ],
buttons : [ {
text : "提交",
type : "submit",
handler : function() {
if (simple.form.isValid()) {
Ext.MessageBox.show( {
title : " 请稍等",
msg : "正在加载.....",
progressText : "",
width : 300,
progress : true,
closable : false,
animEl : "loding"
});
var f = function(v) {
return function() {
var i = v / 11;
Ext.MessageBox.updateProgress(i, '');
}
}
for ( var i = 1; i < 13; i++) {
setTimeout(f(i), i * 150);
}
// 提交到服务器操作
simple.form.doAction("submit", {
url : "Login.action",
method : "post",
params : "",
success : function(form, action) {
document.location = 'user/index.jsp';
Ext.Msg.alert(" 登录成功!", action.result.message);
},
failure : function(form, action) {
Ext.Msg.alert('登陆失败', action.result.message);
}
});
}
}
}, {
text : " 重置",
handler : function() {
// 重置表单
simple.form.reset();
}
} ]
});
// 定义窗体
var _window = new Ext.Window( {
title : "登录窗口",
layout : "fit",
width : 280,
height : 150,
plain : true,
bodyStyle : "padding:10px;",
maximizable : false,
closeAction : "close",
closable : false,
collapsible : true,
plain : true,
buttonAlign : "center",
items : simple
});
simple.getForm().load( {
url:'Login!hello.action',

//url : 'hello.jsp',

waitTitle : '提示',

waitMsg : '正在处理您的请求,请稍候...',
success : function(form, action) {
Ext.Msg.alert('hello');
},
failure : function(form, action) {
Ext.Msg.alert('失败...');
}

}

);
_window.show();
});
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值