extjs 提交表单错误高人帮忙看看啊!

yueyang 2008-10-31 02:12:54
一点提交就提示错误:
Line:24
Char:1513
Code:0
Error:语法错误
到底错在哪里了呢?

<script type="text/javascript">
Ext.onReady(function(){
Ext.QuickTips.init();
Ext.form.Field.prototype.msgTarget = 'side';
var top = new Ext.FormPanel({
labelWidth: 70,
frame:true,
title: '系统设置',
bodyStyle: 'padding:5px 5px 0',
style: 'margin: 10px',
width: 700,
defaults: {width: 230},
defaultType: 'textfield',
items: [{
fieldLabel: '标 题',
name: 'title'
},{
fieldLabel: '短标题',
name: 'shorttitle'
},{
xtype:'combo',
store: new Ext.data.SimpleStore({
fields: ["retrunValue", "displayText"],
data: [[0,'无']]
}),
valueField :"retrunValue",
displayField: "displayText",
mode: 'local',
editable: false,
forceSelection: true,
triggerAction: 'all',
hiddenName:'category',
fieldLabel: '分 类',
emptyText:'选择分类',
name: 'category'
},{
fieldLabel: '作 者',
name: 'author'
},{
fieldLabel: '来 源',
name: 'source'
},{
xtype:'textarea',
fieldLabel: '摘 要',
id:'brief',
name: 'brief'
},{
xtype: 'htmleditor',
fieldLabel: '内 容',
width: 500,
name: 'content',
fontFamilies: ['宋体','黑体']
},{
xtype:'combo',
store: new Ext.data.SimpleStore({
fields: ["retrunValue", "displayText"],
data: [[1,'显示'],[0,'隐藏']]
}),
valueField :"retrunValue",
displayField: "displayText",
mode: 'local',
editable: false,
forceSelection: true,
triggerAction: 'all',
hiddenName:'status',
fieldLabel: '状 态',
emptyText:'选 择',
name: 'status',
value: 0
},{
xtype:'hidden',
name: 'id',
id:'id',
value: ''
}],

buttons: [{
text: '确定',
handler:function(){
if(top.form.isValid()){
top.form.doAction('submit',{
url:'index2.php?model=news&action=save',
method:'post',
params:'',
success:function(form,action){
Ext.Msg.alert('操作','保存成功!');
},
failure:function(){
Ext.Msg.alert('操作','服务器出现错误请稍后再试!');
}
});
}
}
},{
text: '重置',
handler:function(){
Ext.Msg.alert('操作','服务器出现错误请稍后再试!');
top.form.reset();
}
}]
});
top.render(document.body);
//loadend();
});
</script>

...全文
261 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
yueyang 2008-11-01
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 YINLIANGSHENG8MCHINA 的回复:]
index2.php?model=news&action=save //后台的处理有错误

我已经对你的代码调试了下,是正确的,很有可能是在服务器端处理错误 而没有正确返回数据导致

我在代码里面只替换了url:'register.aspx?model=news&action=save',这个参数

然后在'register.aspx.cs里面我只写了一条语句:Response.Write("{success:true}");

测试的结果是成功的.

所以 建议你查查你的服务器端代码吧


欢迎访问Ext博客
[/Quote]

现在代码不报错了,但是总是提示那个失败后的信息。怎样才能返回成功信息呢?
  • 打赏
  • 举报
回复
检查你你服务器端的代码
以梦为马 2008-10-31
  • 打赏
  • 举报
回复
这么长
  • 打赏
  • 举报
回复
index2.php?model=news&action=save //后台的处理有错误

我已经对你的代码调试了下,是正确的,很有可能是在服务器端处理错误 而没有正确返回数据导致

我在代码里面只替换了url:'register.aspx?model=news&action=save',这个参数

然后在'register.aspx.cs里面我只写了一条语句:Response.Write("{success:true}");

测试的结果是成功的.

所以 建议你查查你的服务器端代码吧




欢迎访问Ext博客
yueyang 2008-10-31
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 sy_binbin 的回复:]
index2.php?model=news&action=save

这个页面在你项目里是否存在
[/Quote]

存在的,帮我改改让他能用啊。
sy_binbin 2008-10-31
  • 打赏
  • 举报
回复
或者用Ext.Ajax.request这种方式提交一次看看
sy_binbin 2008-10-31
  • 打赏
  • 举报
回复
index2.php?model=news&action=save

这个页面在你项目里是否存在
yueyang 2008-10-31
  • 打赏
  • 举报
回复
下面是完整的页面文件

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Grid3 Example</title>
<link rel="stylesheet" type="text/css" href="ext/resources/css/ext-all.css" />
<script type="text/javascript" src="ext/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="ext/ext-all.js"></script>
<script type="text/javascript" src="common.js"></script>
<style type="text/css">
.add {
background-image:url(images/icons/fam/add.gif) !important;
}
.option {
background-image:url(images/icons/fam/plugin.gif) !important;
}
.remove {
background-image:url(images/icons/fam/delete.gif) !important;
}
</style>
</head>
<body>
<script type="text/javascript">
Ext.onReady(function(){
Ext.QuickTips.init();
Ext.form.Field.prototype.msgTarget = 'side';
var top = new Ext.FormPanel({
labelWidth: 70,
frame:true,
title: '系统设置',
bodyStyle: 'padding:5px 5px 0',
style: 'margin: 10px',
width: 700,
defaults: {width: 230},
defaultType: 'textfield',
items: [{
fieldLabel: '标 题',
name: 'title'
},{
fieldLabel: '短标题',
name: 'shorttitle'
},{
xtype:'combo',
store: new Ext.data.SimpleStore({
fields: ["retrunValue", "displayText"],
data: [[0,'无']]
}),
valueField :"retrunValue",
displayField: "displayText",
mode: 'local',
editable: false,
forceSelection: true,
triggerAction: 'all',
hiddenName:'category',
fieldLabel: '分 类',
emptyText:'选择分类',
name: 'category'
},{
fieldLabel: '作 者',
name: 'author'
},{
fieldLabel: '来 源',
name: 'source'
},{
xtype:'textarea',
fieldLabel: '摘 要',
id:'brief',
name: 'brief'
},{
xtype: 'htmleditor',
fieldLabel: '内 容',
width: 500,
name: 'content',
fontFamilies: ['宋体','黑体']
},{
xtype:'combo',
store: new Ext.data.SimpleStore({
fields: ["retrunValue", "displayText"],
data: [[1,'显示'],[0,'隐藏']]
}),
valueField :"retrunValue",
displayField: "displayText",
mode: 'local',
editable: false,
forceSelection: true,
triggerAction: 'all',
hiddenName:'status',
fieldLabel: '状 态',
emptyText:'选 择',
name: 'status',
value: 0
},{
xtype:'hidden',
name: 'id',
id:'id',
value: ''
}],

buttons: [{
text: '确定',
handler:function(){
if(top.form.isValid()){
top.form.doAction('submit',{
url:'index2.php?model=news&action=save',
method:'post',
params:'',
success:function(form,action){
Ext.Msg.alert('操作','保存成功!');
},
failure:function(){
Ext.Msg.alert('操作','服务器出现错误请稍后再试!');
}
});
}
}
},{
text: '重置',
handler:function(){
Ext.Msg.alert('操作','服务器出现错误请稍后再试!');
top.form.reset();
}
}]
});
top.render(document.body);
});
</script>
</body>
</html>
  • 打赏
  • 举报
回复
24是那行

87,907

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧