Ext.form.Panel 表单提交问题
2011-09-20 08:54
507 查看
1,脚本代码
Ext.require([
'Ext.data.*',
'Ext.grid.*',
'Ext.form.*'
]);
Ext.onReady(function(){
Ext.create('Ext.form.Panel', {
title: 'Simple Form',
bodyPadding: 5,
width: 350,
// The form will submit an AJAX request to this URL when submitted
url: 'insertData.fwp',
// Fields will be arranged vertically, stretched to full width
layout: 'anchor',
defaults: {
anchor: '100%'
},
// The fields
defaultType: 'textfield',
items: [{
fieldLabel: 'First Name',
name: 'first',
allowBlank: false
},{
fieldLabel: 'Last Name',
name: 'last',
allowBlank: false
}],
// Reset and Submit buttons
buttons: [{
text: 'Reset',
handler: function() {
this.up('form').getForm().reset();
}
}, {
text: 'Submit',
formBind: true, //only enabled once the form is valid
disabled: false,
handler: function() {
var form = this.up('form').getForm();
if (form.isValid()) {
debugger;
form.submit({
success: function(form, action) {
Ext.Msg.alert('Success', action.result.msg);
},
failure: function(form, action) {
Ext.Msg.alert('Failed', action.result.msg);
}
});
}
}
}],
renderTo: Ext.getBody()
});
});
2,服务器端代码
<%@ LANGUAGE=JavaScript %>
<%
debugger;
var first = Request.Form("first");
var second = Request.Form("last");
var retu = '{"success":false, "msg":"You do not have permission to perform this operation"}';
Response.Write(retu);
%>
Ext.require([
'Ext.data.*',
'Ext.grid.*',
'Ext.form.*'
]);
Ext.onReady(function(){
Ext.create('Ext.form.Panel', {
title: 'Simple Form',
bodyPadding: 5,
width: 350,
// The form will submit an AJAX request to this URL when submitted
url: 'insertData.fwp',
// Fields will be arranged vertically, stretched to full width
layout: 'anchor',
defaults: {
anchor: '100%'
},
// The fields
defaultType: 'textfield',
items: [{
fieldLabel: 'First Name',
name: 'first',
allowBlank: false
},{
fieldLabel: 'Last Name',
name: 'last',
allowBlank: false
}],
// Reset and Submit buttons
buttons: [{
text: 'Reset',
handler: function() {
this.up('form').getForm().reset();
}
}, {
text: 'Submit',
formBind: true, //only enabled once the form is valid
disabled: false,
handler: function() {
var form = this.up('form').getForm();
if (form.isValid()) {
debugger;
form.submit({
success: function(form, action) {
Ext.Msg.alert('Success', action.result.msg);
},
failure: function(form, action) {
Ext.Msg.alert('Failed', action.result.msg);
}
});
}
}
}],
renderTo: Ext.getBody()
});
});
2,服务器端代码
<%@ LANGUAGE=JavaScript %>
<%
debugger;
var first = Request.Form("first");
var second = Request.Form("last");
var retu = '{"success":false, "msg":"You do not have permission to perform this operation"}';
Response.Write(retu);
%>
相关文章推荐
- Ext.js form 表单提交问题
- ExtJS学习笔记(5)- Form表单的提交 -Ext.FormPanel
- Extjs初始化/提交Ext.form.FormPanel,表单中包含textfield,textarea,radio,checkbox,combo等
- Ext.form.FormPanel表单提交
- 当button按钮放入form表单进行ajax提交遇到的诡异问题
- form 表单提交到 iframe 遇到的问题
- Form表单提交参数类型与后台实体参数类型的问题
- SpringBind对象到页面时,用ajax提交form表单内容,后台无法获取绑定对象问题
- 一个IE7下,用form表单跳转iframe提交,然后下载文件。遇到的很有意思的问题
- 摘录:网页form表单重复提交的问题
- Ext.FormPanel 提交和 Ext.Ajax.request 异步提交函数的区别
- 表单提交中form.action,form.submit()问题
- ajax异步、同步问题,KindEditor ajax提交内容,ajax提交form表单 解决按两次的问题
- form表单底下的button按钮点击自动提交恶心问题的解决
- form表单提交,后台获取不到参数值问题(前题是页面参数正常没有错误)
- 关于Ext.form.FormPanel的reset方法的问题
- form表单下的button按钮会自动提交表单的问题
- 关于jquery的ajax提交form表单的域模型问题
- 解决Form表单重复提交问题
- java中multipart/form-data方式提交表单添加验证问题