easyui-validatebox验证 radio

添加规则

$.extend($.fn.validatebox.defaults.rules, {
        requireRadio: {  
            validator: function(value, param){  
                var input = $(param[0]);
                input.off('.requireRadio').on('click.requireRadio',function(){
                    $(this).focus();
                });
                return $(param[0] + ':checked').val() != undefined;
            },  
            message: 'Please choose option for {1}.'  
        }  
    });

 

使用方法

<input class="easyui-validatebox" type="radio" name="yes_no" value="1" data-options="validType:'requireRadio[\'#ff input[name=yes_no]\', \'Yes or no\']'">Yes

<input class="easyui-validatebox" type="radio" name="yes_no" value="0">No

 

posted @ 2014-07-29 17:06  Michael Zhang x  Views(5126)  Comments(0Edit  收藏  举报