addForm = new Ext.FormPanel(
{
url : 'accountBalance__operator',
defaultType : 'textfield',
labelAlign : 'right',
labelWidth : 120,
autoHeight : true,
bodyStyle : 'padding:5px',
border : false,
// fileUpload : true,
baseCls : 'x-plain',
items :
[merchant,wagerType,businessmoney,orderno,game,period,infoArea
],
buttonAlign : 'center',
minButtonWidth : 60,
buttons : [ {
text : '提交',
handler : function(btn) {
if (addForm.getForm().isValid() == false) {
Ext.Msg.show({
title : '提示',
msg : '无法提交,请检查输入项!',
buttons : Ext.MessageBox.OK,
icon : Ext.Msg.INFO
});
return;
}
if (addForm.getForm().isValid()) {
btn.disable();
addForm.getForm().submit({
waitTitle : '请稍候',
waitMsg : '正在提交表单数据,请稍候...',
success : function(form, action) {
Ext.Msg.show({ title : '提示', msg :
'成功!!', buttons :
Ext.MessageBox.OK, icon :
Ext.Msg.INFO });
addWindow.close();
},
failure : function(form, action) {
Ext.Msg.alert('错误', action.result.msg);
}
});
btn.enable();
}
}
}, {
text : '重置',
handler : function() {
addForm.getForm().reset();
}
}, {
text : '取消',
handler : function() {
addWindow.close();
}
} ]
})
action类
拼json字符串
jsonMsg = "{\"success\":false,\"msg\":\""+entity.getErrorMsg()+"\"}";
FundManageReturn entity = (FundManageReturn) frontClient.syncSend(fm);
if(entity!=null){
if(!entity.isStatus()){
jsonMsg = "{\"success\":false,\"msg\":\""+entity.getErrorMsg()+"\"}";
this.getResponse().setCharacterEncoding("UTF-8");
this.getResponse().getWriter().write(jsonMsg);
this.getResponse().getWriter().flush();
}else{
jsonMsg = "{\"success\":true,\"msg\":\"成功\"}";
this.getResponse().setCharacterEncoding("UTF-8");
this.getResponse().getWriter().write(jsonMsg);
this.getResponse().getWriter().flush();
}
分享到:
相关推荐
Ext.Msg.alert('失败', '表单提交失败: ' + action.result.message); } }); } else { Ext.Msg.alert('警告', '请检查表单数据!'); } } }] }); ``` 在这个例子中,当用户点击提交按钮时,会触发`handler`...
根据给定的信息,本文将详细解释“Ext 添加功能form表单实例”的知识点,这主要针对Ext初学者。本文会从创建表单、字段定义、验证规则以及提交逻辑等方面进行深入探讨。 ### Ext 添加功能form表单实例 #### 表单...
Ext.Msg.alert('操作', action.result.actionInfo); newFs.getForm().reset(); store.reload(); }, failure: function(form, action) { Ext.Msg.alert('保存失败!', '原因:' + action.result.actionInfo); ...
对于表单提交,返回函数类似,只是从`action.result`中获取数据: ```javascript function(form, action) { var id = action.result.id; var text = action.result.text; var url = action.result.url; var ...
Ext.Msg.alert('操作', action.result.data); item.disabled = false; }, failure: function(form, action) { Ext.Msg.alert('警告', '用户名或密码错误!'); item.disabled = false; } }); item.disabled ...
console.log("表单数据:" + Ext.encode(formData)); Ext.getCmp("msgBasicMsg").getForm().submit({ url : 'insertMsg.action?msgBean=' + formData, //等待时显示 等待 waitTitle : '请稍等...', waitMsg : '...
Ext.Msg.alert('登陆错误', action.result.msg); } }, failure: function(){ Ext.Msg.alert('错误', '服务器出现问题'); } }); } } }] }); }); ``` - **表单初始化**: `Ext.QuickTips.init();` 启用了...
Ext.Msg.alert('失败', action.result.message); } }); } } }] }] }); } }); ``` 文件下载则可以通过创建一个隐藏的`<a>`标签或者利用JavaScript创建一个`Blob`对象并创建一个新的`window.URL....
Ext.Msg.alert(' 成功 ', action.result.msg); }, failure: function() { Ext.Msg.alert(' 失败 ', ' 提交失败 '); } }); ``` 在服务器端,可以获取表单提交的数据,例如在JSP中通过`request.getParameter(...
在这里,`failure` 和 `success` 回调函数的第二个参数 `action` 包含了服务器响应的详细信息,如 `action.result.msg` 可以获取到服务器返回的消息。然而,`Ext.Ajax.request` 的一个显著缺点是不支持 `waitMsg` ...
Ext.Msg.alert('失败', '提交失败:' + action.result.message); } }); } } }] }); ``` 通过上述知识点,我们可以了解到EXTJS在处理表单提交方面的强大能力。结合实际项目需求,利用EXTJS提供的API和事件机制...
Ext.Msg.alert('成功', action.result.message); }, failure: function(form, action) { Ext.Msg.alert('失败', action.result.error); } }); } } }] }); ``` 在后台,Java通常使用Servlet或Spring MVC来...
Ext.Msg.alert('失败', action.result.message); } } } ``` 6. **显示 FormPanel**:最后,将 FormPanel 添加到页面的某个容器中,使其可见。 ```javascript Ext.application({ name: 'MyApp', launch: ...
Ext.Msg.alert('保存成功', action.result.msg); }, failure: function(form, action) { Ext.Msg.alert('操作失败', action.result.msg); } }); ``` 总之,EXTJS4中的FormPanel结合BasicForm,为我们提供了一...
Ext.Msg.alert('成功', action.result.message); document.location.href = 'Main.html'; win.hide(); }, failure: function(form, action) { Ext.Msg.alert('失败', action.result.message); } }); } } ...
Ext.Msg.alert('失败', action.result.errmsg); } }); } }] }); ``` 在后端,Java通常会使用Servlet或者Spring MVC来处理文件上传。Servlet API提供了一个Part接口,用于处理multipart/form-data请求中的部分...
// Ext.Msg.alert("load", Ext.encode(action.result.data)); }, failure: function(form, action) { Ext.Msg.alert("提示", "获取失败"); } }); ``` 这里的关键点在于: - `url`: 指定从哪里获取数据。 - `...
`Ext.form.Action` 是用于处理表单操作的类,主要包括提交和加载数据的功能。 - **属性:** - `success`: 表示操作成功时的回调函数。 - `failure`: 表示操作失败时的回调函数。 - `method`: 请求方式,默认为 `...
Ext.Msg.alert('失败', action.result.message); } }); } }] }); ``` 在上述代码中,我们创建了一个表单面板,其中包括一个`fileField`,用户可以通过它选择要上传的文件。按钮点击事件触发表单提交,指定的...