Ext 表单提交时怎么总是提示值未定义啊,都调了一下午了
html 页
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="login.aspx.cs" Inherits="login" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<link href="css/StyleSheet.css" rel="stylesheet" type="text/css" />
<link href="ext/resources/css/ext-all.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="ext/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="ext/ext-all.js"></script>
</head>
<body>
<form id="form1" runat="server">
<div>
<script>
Ext.QuickTips.init();
LoginWindow=Ext.extend(Ext.Window,{
title : '登陆系统',
width : 265,
height : 170,
collapsible : true,
defaults : {
border : false
},
buttonAlign : 'center',
createFormPanel :function() {
return new Ext.form.FormPanel( {
bodyStyle : 'padding-top:6px',
defaultType : 'textfield',
labelAlign : 'right',
labelWidth : 55,
labelPad : 0,
frame : true,
defaults : {
allowBlank : false,
width : 158
},
items : [{
cls : 'user',
name : 'username',
fieldLabel : '帐号',
blankText : '帐号不能为空'
}, {
cls : 'key',
name : 'password',
fieldLabel : '密码',
blankText : '密码不能为空',
inputType : 'password'
}, {
cls : 'key',
name:'randCode',
id:'randCode',
fieldLabel:'验证码',
width:80,
blankText : '验证码不能为空'
}]
});
},
login:function() {
this.fp.form.submit({
waitMsg : '正在登录......',
url : 'login.ashx?cmd=login',
success : function(form, action) {
//alert(action.response.responseText)
//window.location.href = 'default.aspx';
},
failure : function(form, action) {
form.reset();
if (action.failureType == Ext.form.Action.SERVER_INVALID)
Ext.MessageBox.alert('警告', action.result.errors.msg);
}
});
},
initComponent : function(){
LoginWindow.superclass.initComponent.call(this);
this.fp=this.createFormPanel();
this.add(this.fp);
this.addButton('登陆',this.login,this);
this.addButton('重置', function(){this.fp.form.reset();},this);
}
});
Ext.onReady(function()
{
var win=new LoginWindow();
win.show();
var bd = Ext.getDom('randCode');
var bd2 = Ext.get(bd.parentNode);
bd2.createChild({tag: 'img', src: 'checkcode.aspx',align:'absbottom'});
}
);
</script>
</div>
</form>
</body>
</html>
login.ashx 后台代码:
<%@ WebHandler Language="C#" Class="login" %>
using System;
using System.Web;
public class login : IHttpHandler {
public void ProcessRequest (HttpContext context) {
string cmd = context.Request["cmd"];
if (cmd == "login")
{
context.Response.Write("success");
}
}
public bool IsReusable {
get {
return false;
}
}
}
请高手帮我看是什么问题,我一提交就有脚本错误:
行: 24
字符: 1519
错误: 'success' 未定义
代码: 0
URL: http://localhost:3760/Ext_Demo/login.aspx
在线等
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="login.aspx.cs" Inherits="login" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<link href="css/StyleSheet.css" rel="stylesheet" type="text/css" />
<link href="ext/resources/css/ext-all.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="ext/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="ext/ext-all.js"></script>
</head>
<body>
<form id="form1" runat="server">
<div>
<script>
Ext.QuickTips.init();
LoginWindow=Ext.extend(Ext.Window,{
title : '登陆系统',
width : 265,
height : 170,
collapsible : true,
defaults : {
border : false
},
buttonAlign : 'center',
createFormPanel :function() {
return new Ext.form.FormPanel( {
bodyStyle : 'padding-top:6px',
defaultType : 'textfield',
labelAlign : 'right',
labelWidth : 55,
labelPad : 0,
frame : true,
defaults : {
allowBlank : false,
width : 158
},
items : [{
cls : 'user',
name : 'username',
fieldLabel : '帐号',
blankText : '帐号不能为空'
}, {
cls : 'key',
name : 'password',
fieldLabel : '密码',
blankText : '密码不能为空',
inputType : 'password'
}, {
cls : 'key',
name:'randCode',
id:'randCode',
fieldLabel:'验证码',
width:80,
blankText : '验证码不能为空'
}]
});
},
login:function() {
this.fp.form.submit({
waitMsg : '正在登录......',
url : 'login.ashx?cmd=login',
success : function(form, action) {
//alert(action.response.responseText)
//window.location.href = 'default.aspx';
},
failure : function(form, action) {
form.reset();
if (action.failureType == Ext.form.Action.SERVER_INVALID)
Ext.MessageBox.alert('警告', action.result.errors.msg);
}
});
},
initComponent : function(){
LoginWindow.superclass.initComponent.call(this);
this.fp=this.createFormPanel();
this.add(this.fp);
this.addButton('登陆',this.login,this);
this.addButton('重置', function(){this.fp.form.reset();},this);
}
});
Ext.onReady(function()
{
var win=new LoginWindow();
win.show();
var bd = Ext.getDom('randCode');
var bd2 = Ext.get(bd.parentNode);
bd2.createChild({tag: 'img', src: 'checkcode.aspx',align:'absbottom'});
}
);
</script>
</div>
</form>
</body>
</html>
login.ashx 后台代码:
<%@ WebHandler Language="C#" Class="login" %>
using System;
using System.Web;
public class login : IHttpHandler {
public void ProcessRequest (HttpContext context) {
string cmd = context.Request["cmd"];
if (cmd == "login")
{
context.Response.Write("success");
}
}
public bool IsReusable {
get {
return false;
}
}
}
请高手帮我看是什么问题,我一提交就有脚本错误:
行: 24
字符: 1519
错误: 'success' 未定义
代码: 0
URL: http://localhost:3760/Ext_Demo/login.aspx
在线等
...全文
相关推荐
ext 表单提交
NULL 博文链接:https://lym6520.iteye.com/blog/339556
EXT异步提交FORM表单
EXT异步提交FORM表单的使用和,以及EXT配合struts2,sprint2.5进行前台和后台的交互解释和运用.....
ext form 表单提交数据的方法小结
Ext 表单提交数据的三种方法小结,方便利用ext提交数据的朋友
ext_表单提交_数据校验
ext_表单提交_数据校验 ext_表单提交_数据校验
EXT dojochina ExtAjax表单提交 L9.rar
EXT dojochina ExtAjax表单提交 L9.rar EXT dojochina ExtAjax表单提交 L9.rar


