weixin_42322952 2009-07-21 17:31
浏览 173
已采纳

关于'radio'的简单问题

items: {
xtype: 'fieldset',
title: 'Individual Radios',
autoHeight: true,

        defaultType: 'radio', // each item will be a radio button
        items: [{
            xtype: 'textfield',
            name: 'txt-test2',
            fieldLabel: 'Alignment Test'
        }, {

            fieldLabel: 'Favorite Color',
            boxLabel: 'Red',
            name: 'fav-color',
            inputValue: 'red'
        }, {
            fieldLabel: '',
            labelSeparator: '',
            boxLabel: 'Blue',
            name: 'fav-color',
            inputValue: 'blue'
        }, {
            fieldLabel: '',
            labelSeparator: '',
            boxLabel: 'Green',
            name: 'fav-color',
            inputValue: 'green'
        }]
    }

在客户端验证时单选框不能为空.应该怎么写.
allowBlank: false,找了半天我也不知道加在什么地方
[b]问题补充:[/b]
需求就是没有默认数值...怎么搞啊

  • 写回答

4条回答 默认 最新

  • iteye_10013 2009-07-22 09:08
    关注

    都说了,用radiogroup....
    示例代码:

    [code="javascript"]
    Ext.onReady(function(){
    Ext.BLANK_IMAGE_URL = '/images/s.gif';
    Ext.QuickTips.init();
    testFormValid();
    });
    function testFormValid(){
    var f = new Ext.form.FormPanel({
    height:300,
    width:500,
    renderTo:document.body,
    items:[
    {
    xtype: 'radiogroup',
    fieldLabel: 'Auto Layout',
    allowBlank:false,
    items: [
    {boxLabel: 'Item 1', name: 'rb-auto', inputValue: 1},
    {boxLabel: 'Item 2', name: 'rb-auto', inputValue: 2},
    {boxLabel: 'Item 3', name: 'rb-auto', inputValue: 3},
    {boxLabel: 'Item 4', name: 'rb-auto', inputValue: 4},
    {boxLabel: 'Item 5', name: 'rb-auto', inputValue: 5}
    ]
    },
    {
    xtype:'button',
    text:'submit',
    handler:function(){
    f.getForm().submit({
    url: 'updateConsignment.php',
    clientValidation: true,
    failure: function(form, action) {
    switch (action.failureType) {
    case Ext.form.Action.CLIENT_INVALID:
    Ext.Msg.alert('失败', '验证失败');
    break;
    }
    }
    })
    }
    }
    ]
    });
    }
    [/code]

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看