ext form提交问题 - Web 开发 / Ajax
Ext.BLANK_IMAGE_URL = 'script/resources/images/default/s.gif';  
Ext.QuickTips.init();  
var SysuserForm=new Ext.form.FormPanel({  
//el:'SysuerForm',  
defaultType:'textfield',  
labelAlign:'right',  
labelWidth:120,  
frame:true,  
width:200,  
autoHeight:true,  
waitMsgTarget:true,  
items:[{  
cls : 'user',  
name:'userid',  
fieldLabel:'用户名',  
blankText:'用户名不能为空',  
allowBlank:false  
},{  
cls : 'key',  
inputType:'password',  
fieldLabel: '密   码',  
name: 'passwd',  
blankText:'密码不能为空',  
allowBlank:false  
}],  
buttons:[{  
text:'登陆',  
handler:submitValid  
},{  
text:'重置',  
handler:function(){  
SysuserForm.getForm().reset();  
}  
},{  
text:'注册',  
handler:function(){  
document.forms[0].passwd.value="";  
document.forms[0].userid.value="";  
window.location.href="login.do";  
}  
}]  
});  
function submitValid(){  
if(SysuserForm.form.isValid()){  
document.forms[0].passwd.value = document.forms[0].passwd.value;  
//document.forms[0].passwd.value = 'admin';  
//alert(document.forms[0].passwd.value);  
SysuserForm.getForm().submit({  
url:'login.do',  
waitMsg:'请稍等,正在验证.....',  
success:onLoginSuccess,  
failure:onFailure  
});}else{  
Ext.MessageBox.alert('提示','请输入完整信息');  
}  
}  
var onLoginSuccess=function(form,action){  
alert('sfsdfs');  
window.location.href="login.do";  
};  
var onFailure=function(form,action){  
document.forms[0].userid.value="";  
document.forms[0].passwd.value="";  
Ext.MessageBox.alert('提示','用户名或密码错误,请确认');  
};  
var win=new Ext.Window({  
el:'login-win',  
layout:'fit',  
title:'用户登录',  
width:340,  
height:150,  
items:[SysuserForm]  
});  
Ext.onReady(function(){  
win.show();  
});  
我用的是SSH+ext
直接在注册里面配置window.location.href,登陆没问题,但是登陆里面配的就不跳转了,在onLoginSuccess里面的alter()也没弹出来,是不是success里面就错了?请帮忙看一下问题出在哪
------解决方案--------------------Ext.Msg.alert('Status', 'Login Successful!', function(btn, text){
				   		if (btn == 'ok')
				   		{
		                	var redirect = '***.jsp';  
		                    window.location = redirect;
                       }
			        	});
------解决方案--------------------返回数据格式错误可能。
------解决方案--------------------
没有到success,估计是到了这有错了,检查一下代码
------解决方案--------------------var onLoginSuccess=function(form,action){  
alert('sfsdfs');  
window.location.href="login.do";  
};  
根据这句来看问题应该出现在login.do里面,
1)检查login.do是否执行
2)如果login也执行了的话那就一定是login.do跳转问题,不知道你login怎么写的,所以自己看看吧!
------解决方案--------------------建议用Firebug调试一下