extjs-->form
来源:互联网 发布:sql replace 正则 编辑:程序博客网 时间:2024/05/02 00:01
表单元素什么的就等下再说,看这个.
在submit的配置项中的failure配置项的对应函数的action参数:
failureType:The type of failure detected will be one of these:CLIENT_INVALID,SERVER_INVALID, CONNECT_FAILURE, or LOAD_FAILURE.
说明了到底是什么原因导致进入failure对应的函数了.
CLIENT_INVALID
Failure type returned when client side validation of the Form fails thus aborting a submit action. Clientside validation is performed unlessExt.form.action.Submit.clientValidation is explicitly set tofalse.
Failure type returned when a communication error happens when attempting to send a request to the remoteserver. Theresponse may be examined to provide further information.
Failure type returned when the response's success
property is set to false, or no field values are returnedin the response's data property.
Failure type returned when server side processing fails and the result's success
property is set tofalse.
In the case of a form submission, field-specific error messages may be returned in theresult'serrors property.
我们返回的json中需要有success这个属性当success不为真(为false或不存在此属性)直接进入failure对应的函数,success为true时,才进入success中
var leftPanel = Ext.create('Ext.form.Panel', { region: 'west', width: 300, resizable: { minWidth: 200, maxWidth: 400 }, defaultType: 'textfield', defaults: { width: 200 }, labelAlign: 'right', items: [ { fieldLabel: '用户名' }, { fieldLabel: '密码', inputType: 'password' }, { xtype: 'checkbox', boxLabel: '低级程序员', name: 'ptype' }, { xtype: 'checkbox', boxLabel: '中级程序员', name: 'ptype' }, { xtype: 'checkbox', boxLabel: '高级程序员', name: 'ptype' }, { xtype: 'combo', fieldLabel: '下拉框框', store: Ext.create('Ext.data.Store', { fields: ['value', 'name'], data: [ {"value": "AL", "name": "Alabama"}, {"value": "AK", "name": "Alaska"}, {"value": "AZ", "name": "Arizona"} ] }), queryModel: 'local', valueField: 'value', displayField: 'name' }, { xtype: 'datefield', fieldLabel: '日期', maxValue: new Date() }, { xtype: 'displayfield', fieldLabel: '显示信息', value: '只是显示数据而已' }, { xtype: 'filefield', name: 'photo', fieldLabel: '头像', msgTarget: 'side', buttonText: '选择' }, { xtype: 'numberfield', name: 'bottles', fieldLabel: '数字', value: 25, maxValue: 100, minValue: 1 }, { xtype: 'fieldcontainer', fieldLabel: '尺寸', defaultType: 'radiofield', defaults: { flex: 1 }, layout: 'hbox', items: [ { boxLabel: '中', name: 'size', inputValue: 'm', id: 'radio1' }, { boxLabel: 'L', name: '大', inputValue: 'l', id: 'radio2' }, { boxLabel: '加大', name: 'size', inputValue: 'xl', id: 'radio3' } ] } ], buttons: [ { text: '提交', handler: function () { leftPanel.getForm().submit({ url: 'a.json', failure: function (form, action) { Ext.Msg.alert('出错了', '错误信息:'+action.failureType); }, success: function (form, action) { if (action.result.result) Ext.Msg.alert('结果正常', '提示信息:' + action.result.msg); else Ext.Msg.alert('结果失败', '提示信息:' + action.result.msg); } }); } } ] }) ;
这就是一个表单了.看最后一点点代码就可以了.
当a.json不包含success这个属性的时候
{ //"success":true, "result": true, "msg": "出错了,无法连接到数据库"}
,报错如图
当包含success时
{ "success":true, "result": true, "msg": "出错了,无法连接到数据库"}结果如图
当success为假时
{ "success":false, "result": true, "msg": "出错了,无法连接到数据库"}看图,和success不存在时是一样的.
- EXTJS FORM
- ExtJS Form
- extjs-->form
- extjs form demo
- Extjs form 验证器
- ExtJs Form布局
- extjs form validate 验证
- ExtJS Form表单上传
- Extjs form 组件
- ExtJs Form布局
- extjs form的提交
- extjs form的提交
- ExtJS.form中msgTarget
- EXTJS 之 form
- Extjs form 组件
- ExtJs之表单(form)
- Extjs Form用法详解
- extjs-form数据加载
- An overview of memory management in QEMU
- iOS archive(归档)的总结
- android使用ImageLoader显示圆角图片
- 特征向量物理意义
- 菜鸟学Android笔记(四十一):JSP指令元素——page指令
- extjs-->form
- Mac之终端常用操作指令(一)
- JPanel绘图
- FATAL: Module iptable_nat not found解决办法
- android 电视端应用不同分辨率的适配
- Myeclipse将控制台日志输出到文件中和显示更多的日志信息
- thinkphp中如何导入js和css文件
- 简述 IOS中的LazyLoad思想
- android 通知栏背景颜色跟随app导航栏背景颜色变化而变化