首页 > 解决方案 > 基于第一个字段值的引导依赖验证

问题描述

在我的设计中,我使用引导验证器代码如下:

$('#user').bootstrapValidator({
    fields: {
        type: {
            validators: {
                notEmpty: {
                    message: 'user Type is required'
                }
            }
        },
        name: {
            validators: {
                notEmpty: {
                    message: 'name is required'
                }
            }
        }
    }
})

当我从下拉名称中选择类型为 2 时,我真正想要的应该是强制性的。如果我从类型中选择 1 然后通过验证我如何在验证器中解决这种验证。任何人有任何想法请建议我提前谢谢

标签: javascriptjquerybootstrapvalidatorjqbootstrapvalidationbootstrap-validate

解决方案


推荐阅读