【问题标题】:fuelux tab and wizard form validationFuelux 选项卡和向导表单验证
【发布时间】:2014-08-21 03:46:24
【问题描述】:

我在FUELUX上做了一些自定义向导,可以显示在这个链接http://jsfiddle.net/L3b9E/2

问题是,我不知道如何在向导中的每个步骤上修复表单验证并由选项卡分隔。因为验证不适用于第二个、第三个等选项卡。

有什么想法吗?

jquery 代码:

var $nextText;
$(document).on('click','[data-wizard]',function(e){
    var $this=$(this),href;
    var $target=$($this.attr('data-target')||(href=$this.attr('href'))&&href.replace(/.*(?=#[^\s]+$)/,''));
    var option=$this.data('wizard');
    var item=$target.wizard('selectedItem');
    var $step=$target.next().find('.step-pane:eq('+(item.step-1)+')');
    !$nextText&&($nextText=$('[data-wizard="next"]').html());
    var cek = 0, $data=[],$e=[],$v=[], $lokasi = $this.attr('lokasi'); //means path to save file

    if(option == "next"){
        $step.find(':input[data-required=true]').each(function(){
            $(this).jinForm('validate');
            if($(this).jinForm('isValid') != true){
                cek = 0;
            }else{
                cek = 1;
                $e.push($(this).attr('id'));
                $v.push($(this).val());

                $data.push($(this).serialize());
            }
        });
        alert($data);
    }

    if(cek == 0){
        return false;
    }else{
        $.post($lokasi,{e:$e,v:$v},function(hasil){ jin.alert(hasil);
            if(hasil==0){
                jin.alert("Saving Data, <b class='text-danger'>Error..!!!</b>");
                return false
            }else{
                $target.wizard(option);
                var activeStep=(option=="next")?(item.step+1):(item.step-1);
                var prev=($(this).hasClass('btn-prev')&&$(this))||$(this).prev();
                var next=($(this).hasClass('btn-next')&&$(this))||$(this).next();
                prev.attr('disabled',(activeStep==1)?true:false);
                next.html((activeStep<$target.find('li').length)?$nextText:next.data('last'));
            }
        }).error(function(){ jin.alert("Save Target Path is <b class='text-danger'>Not Exist</b>..!"); });
    }
});

【问题讨论】:

    标签: jquery validation wizard fuelux


    【解决方案1】:

    here 讨论了类似的情况。它应该提供一些见解。如果不是,请为您的用例提供更多详细信息。

    【讨论】:

    • 这个链接回到同一页面?!
    猜你喜欢
    • 1970-01-01
    • 2013-08-09
    • 1970-01-01
    • 1970-01-01
    • 2011-05-13
    • 1970-01-01
    • 2011-04-28
    • 2012-07-06
    • 1970-01-01
    相关资源
    最近更新 更多