使用BootstrapValidator重新验证字段 [英] Revalidate field using BootstrapValidator

查看:834
本文介绍了使用BootstrapValidator重新验证字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从一个新的cutomer获得了一个项目,而旧程序员在这个项目中使用了BootstrapValidator 0.4.5。

I got a project from a new cutomer and the old programmer used BootstrapValidator 0.4.5 in this project.

问题是我为某些人建立了一个自动盘操作字段,但验证它在自动填充后不适用于此字段或在自动填充后更多激活验证未调用。

The problem is that I build a autofil action for some fields, but the validation it not working for this fields after autofill or more excat after the autofill the validation is not call.

验证仅适用于真实用户操作。

The validation only works for real user action.

以下是我自动填充的部分内容。

Here is a part how I made the autofill.

// autofill
if (options.targetBank) 
{
    options.targetBank.val(data.bankData.name).change();
}

// maybe how to call the revalidation action
$( "#inputBank" ).change(function() {
    $(this).revalidation();
});

我不知道如何调用验证,因为没有更多的0.4.5文档。

And I dont know how to call the validation, because there is no more documentation for 0.4.5.

有没有人有想法?

推荐答案

你可以使用API方法 revalidateField ,当您需要重新验证其值由其他插件更新的字段时使用:

You could use the API method revalidateField, It's used when you need to revalidate the field which its value is updated by other plugin :

$( "#inputBank" ).change(function() {
    $(this).closest('form').bootstrapValidator('revalidateField', $(this).prop('name'));
});

希望这有帮助。

这篇关于使用BootstrapValidator重新验证字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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