当前位置: 首页 > news >正文

Extjs 常见问题:如何提交combobox的值

转至:http://apps.hi.baidu.com/share/detail/5452956

//提交出去的是显示域,而不是值域
//解决很简单,使用hiddenName即可。

examples/my/test_combobox.html

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>my test</title>
    <link rel="stylesheet" type="text/css" href="../../../resources/css/ext-all.css" />
    <script type="text/javascript" src="../../adapter/ext/ext-base.js"> </script>
    <script type="text/javascript" src="../../ext-all-debug.js"> </script>

    <script type="text/javascript">
Ext.onReady(function(){
    Ext.QuickTips.init();
    Ext.form.Field.prototype.msgTarget = 'side';

    var sl = [[1,'10'],[2,'100'],[3,'500'],[4,'1000'],[5,'5000']];
    var store3 = new Ext.data.SimpleStore({
                    fields:["code3",'name3'],
                    data:sl
                });
    var simples = new Ext.FormPanel({
                    baseCls:'x-plain',
                    iconCls : 'icon-info',   
                    bodyStyle:'padding:10px',
            items: [{
                     xtype:'fieldset',
                     title: '必填项',
                    bodyStyle:'padding:5px',
                     autoHeight:true,
                    labelWidth:60,
                     defaults: {readOnly:true,typeAhead:true,allowBlank:false,anchor:'95%',mode:'local',selectOnFocus:true,triggerAction:'all'},
                    defaultType: 'combo',
                            items:[
                            {
                                fieldLabel:"数 量",
                                name:"number",
                                displayField:"name3",
                                valueField:"code3",
                                hiddenName:'number',
                                store:store3,
                                mode:'local',
                                blankText:'数量不能为空'
                            }]
                    }]
                });
                    var win = new Ext.Window({
                        id:'win',
                        layout:'fit',
                        iconCls : 'icon-info',                       
                        width: 470,
                        height: 280,
                        plain: true,
                        bodyStyle:'padding:5px;',
                        closable:true,
                        collapsible:true,
                        items:simples,
                        buttons: [{
                               text: '生 成',
                            type: 'submit',
                                handler:function(){
                                  if(simples.form.isValid()){
                                      Ext.MessageBox.show({
                                           title: '请稍等',
                                           msg: '正在加载...',
                                           progressText: '',
                                           width:400,
                                           progress:true,
                                           closable:false,
                                           animEl: 'loding'
                                       });

                                    simples.form.doAction('submit',{
                                        url:'post.php',//文件路径
                                        method:'post',
                                        params:'',
                                        success:function(form,action){
                                                if (action.result.msg=='ok') {
                                                    Ext.Msg.alert('提交成功',action.result.msg);
                                                    win.close();
                                                } else {
                                                    Ext.Msg.alert('提交失败',action.result.msg);
                                                }
                                        },
                                        failure:function(form,action){
                                                Ext.Msg.alert('错误','服务器出现错误请稍后再试!');
                                        }
                                    });
                                   }                                                         
                                }
                           },{text: '重 置',handler:function(){simples.form.reset();}}
                        ]
                    });
        win.show();
})
    </script>

</head>
<body>

</body>
</html>
补充:

在你的Combobox有id的时候千万不要和hiddenName一样,否则数据不能显示,而数据可以正确返回.这个时候错误很难找.


相关文章:

  • 在flex下,切换模块时出现RemoteClass注册失败
  • jQuery.get(url,[data],[callback])
  • 免费收录网站搜索引擎登录口大全
  • js事件列表
  • Linux下编译安装php扩展pdo_oci
  • 管理sharepoint2010开发者面板的4方法
  • 程序阅读理解题目(高中语文版,附答案)
  • Android 编码规范:(四)通过私有构造器强化不可实例化的能力
  • linux命令split
  • jQuery--联动日历(一)
  • 【背景建模】基于纹理特征的背景建模
  • C#之线程、委托,强强联手操作窗体控件...
  • F1论坛快速回复工具...
  • 页面添加运行代码
  • 基于AS-path的过滤实验
  • 2017 年终总结 —— 在路上
  • ES6 ...操作符
  • httpie使用详解
  • input实现文字超出省略号功能
  • Python实现BT种子转化为磁力链接【实战】
  • Spring核心 Bean的高级装配
  • SpriteKit 技巧之添加背景图片
  • ubuntu 下nginx安装 并支持https协议
  • 初识 beanstalkd
  • 分布式事物理论与实践
  • 浮现式设计
  • 山寨一个 Promise
  • 我看到的前端
  • 怎样选择前端框架
  • 完善智慧办公建设,小熊U租获京东数千万元A+轮融资 ...
  • 整理一些计算机基础知识!
  • ​configparser --- 配置文件解析器​
  • ###C语言程序设计-----C语言学习(6)#
  • (1)STL算法之遍历容器
  • (8)STL算法之替换
  • (android 地图实战开发)3 在地图上显示当前位置和自定义银行位置
  • (delphi11最新学习资料) Object Pascal 学习笔记---第8章第2节(共同的基类)
  • (LeetCode 49)Anagrams
  • (第二周)效能测试
  • (附源码)spring boot车辆管理系统 毕业设计 031034
  • (完整代码)R语言中利用SVM-RFE机器学习算法筛选关键因子
  • (原创)攻击方式学习之(4) - 拒绝服务(DOS/DDOS/DRDOS)
  • (最优化理论与方法)第二章最优化所需基础知识-第三节:重要凸集举例
  • *++p:p先自+,然后*p,最终为3 ++*p:先*p,即arr[0]=1,然后再++,最终为2 *p++:值为arr[0],即1,该语句执行完毕后,p指向arr[1]
  • ... fatal error LINK1120:1个无法解析的外部命令 的解决办法
  • .java 指数平滑_转载:二次指数平滑法求预测值的Java代码
  • .Net - 类的介绍
  • .NET Compact Framework 3.5 支持 WCF 的子集
  • @Transaction注解失效的几种场景(附有示例代码)
  • @开发者,一文搞懂什么是 C# 计时器!
  • [【JSON2WEB】 13 基于REST2SQL 和 Amis 的 SQL 查询分析器
  • [AIGC] SQL中的数据添加和操作:数据类型介绍
  • [AMQP Connection 127.0.0.1:5672] An unexpected connection driver error occured
  • [C#]科学计数法(scientific notation)显示为正常数字
  • [CISCN2019 华东北赛区]Web2