form - bootstrapValidator 表单项验证正确了但是无法提交表单?

查看:260
本文介绍了form - bootstrapValidator 表单项验证正确了但是无法提交表单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

    $('#defaultForm').bootstrapValidator({
        container: 'tooltip',
        feedbackIcons: {
            valid: 'glyphicon glyphicon-ok',
            invalid: 'glyphicon glyphicon-remove',
            validating: 'glyphicon glyphicon-refresh'
        },
        fields: {
            firstName: {
                validators: {
                    stringLength: {
                        enabled: false,
                        min: 4,
                        message: 'The first name must be more than 5 characters'
                    },
                    notEmpty: {
                        message: 'The first name is required'
                    },
                    regexp: {
                        enabled: true,
                        regexp: /^[a-z]+$/i,
                        message: 'The first name must consist of a-z, A-Z characters only'
                    }
                }
            },
            lastName: {
                validators: {
                    stringLength: {
                        min: 4,
                        message: 'The last name must be more than 5 characters'
                    },
                    notEmpty: {
                        message: 'The last name is required'
                    },
                    regexp: {
                        regexp: /^[a-z]+$/i,
                        message: 'The last name must consist of a-z, A-Z characters only'
                    }
                }
            }
        }
    });
});

验证代码如上,两项都验证正确了,但是提交到action的地方无法提交,按钮变成不可点击状态,请问是怎么回事呢?谢谢

解决方案

提交按钮不能用name="submit"

这篇关于form - bootstrapValidator 表单项验证正确了但是无法提交表单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆