【问题标题】:how can i remove validation for progress bar for save functionality如何删除进度条的验证以保存功能
【发布时间】:2021-07-30 22:35:30
【问题描述】:

我有两个按钮“提交”和“保存”的进度条。

当我单击“保存”按钮时,它会验证字段,我如何才能自定义仅用于提交功能我需要验证。但对于保存功能我不需要验证。这是我的代码

$(".next").click(function () {
            $('#msform').validate();
            if (!$('#msform').valid()) {
                return false;
            }

            
            current_fs = $(this).parent();
            next_fs = $(this).parent().next(); 

            
            //Add Class Active
            $("#progressbar div").eq($("fieldset").index(next_fs)).addClass("active");

            
            //show the next fieldset
            next_fs.show();
            //hide the current fieldset with style
            current_fs.animate({ opacity: 0 }, {
                step: function (now) {
                    // for making fielset appear animation
                    opacity = 1 - now;

                    current_fs.css({
                        'display': 'none',
                        'position': 'relative'
                    });
                    next_fs.css({ 'opacity': opacity });
                },
                duration: 600
            });
        });

        $(".previous").click(function () {

            current_fs = $(this).parent();
            previous_fs = $(this).parent().prev();

            //Remove class active
            $("#progressbar div").eq($("fieldset").index(current_fs)).removeClass("active");

            //show the previous fieldset
            previous_fs.show();

            //hide the current fieldset with style
            current_fs.animate({ opacity: 0 }, {
                step: function (now) {
                    // for making fielset appear animation
                    opacity = 1 - now;

                    current_fs.css({
                        'display': 'none',
                        'position': 'relative'
                    });
                    previous_fs.css({ 'opacity': opacity });
                },
                duration: 600
            });
        });



        //$(".submit").click(function () {
        //    return false;
        //})

如何区分保存和提交单击以进行验证。任何帮助将不胜感激。

【问题讨论】:

  • 在保存按钮中使用 formnovalidate 属性。

标签: jquery validation progress-bar


【解决方案1】:

在保存按钮中使用 formnovalidate="formnovalidate"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-08-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-12-26
    • 2018-09-26
    • 1970-01-01
    相关资源
    最近更新 更多