最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Revalidate field using BootstrapValidator - Stack Overflow

programmeradmin10浏览0评论

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();
});

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

Has anyone an idea ?

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();
});

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

Has anyone an idea ?

Share Improve this question edited Nov 14, 2016 at 15:02 Zakaria Acharki 67.5k15 gold badges78 silver badges106 bronze badges asked Nov 14, 2016 at 14:42 ToyRoboticToyRobotic 5972 gold badges10 silver badges32 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 4

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'));
});

Hope this helps.

发布评论

评论列表(0)

  1. 暂无评论