• 设为首页
  • 收藏本站
  • 积分充值
  • VIP赞助
  • 手机版
  • 微博
  • 微信
    微信公众号 添加方式:
    1:搜索微信号(888888
    2:扫描左侧二维码
  • 快捷导航
    福建二哥 门户 查看主题

    Extjs 4.x 得到form CheckBox 复选框的值

    发布者: 琛瑞6678 | 发布时间: 2025-8-13 20:26| 查看数: 89| 评论数: 0|帖子模式

    CheckBox(复选框)主要用来接收用户选择的选项

    如图所示(请忽略UI的不好看):



    该弹出窗口的主要代码如下:

    var win = new Ext.Window({
    modal : true,
    title : '确定要拒绝该表吗?',
    width : 500,
    plain : true,
    items : [fp]
    });
    win.show();

    弹出的窗口是载体,items里面的[fp]是form表单的句柄。

    具体定义如下:

    var fp = Ext.create('Ext.FormPanel', {
    frame: true,
    fieldDefaults: {
    labelWidth: 110
    },
    width: 500,
    bodyPadding: 10,
    items: [
    {
    xtype: 'fieldset',
    flex: 1,
    //title: '确定要拒绝该张表吗?',
    defaultType: 'checkbox',
    layout: 'anchor',
    defaults: {
    anchor: '100%',
    hideEmptyLabel: false
    },
    items:[{
    fieldLabel: '请选择拒绝原因:',
    boxLabel: '该表没有填写完整。',
    name:'integrity',
    inputValue: '1'
    }, {
    name:'correct',
    boxLabel: '该表填写不准确。',
    inputValue: '1'
    }]
    }],
    buttons: [
    {text: '确认',handler: function(){
    //得到完整性和准确性信息 有则为1 没有为0
    if(fp.getForm().isValid()){                 
    console.log(fp.getForm().findField('integrity').getValue()?1:0);
    console.log(fp.getForm().findField('correct').getValue()?1:0)
    }
    win.hide();
    }
    },{
    text: '取消',
    handler: function(){
       win.hide();
     }
      }]
      });

    这里面基本涵盖了所有的感兴趣的信息。具体的参见API吧本身不难

    着重说下得到checkBox的值

    console.log(fp.getForm().findField('integrity').getValue()?1:0);
    console.log(fp.getForm().findField('correct').getValue()?1:0)

    这两句话就是如何得到完整性和正确性的值。
    来源:互联网
    免责声明:如果侵犯了您的权益,请联系站长(1277306191@qq.com),我们会及时删除侵权内容,谢谢合作!

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    ×

    最新评论

    QQ Archiver 手机版 小黑屋 福建二哥 ( 闽ICP备2022004717号|闽公网安备35052402000345号 )

    Powered by Discuz! X3.5 © 2001-2023

    快速回复 返回顶部 返回列表