1000hz / bootstrap-validator

A user-friendly HTML5 form validation jQuery plugin for Bootstrap 3
http://1000hz.github.io/bootstrap-validator
MIT License
2.38k stars 1.07k forks source link

Feature proposal - Programmatically trigger an error #636

Open FGIKCM opened 5 years ago

FGIKCM commented 5 years ago

The "remote validation" is not always possible, for example when the time needed to validate the data is very long and need some heavy processing on the server side. (We will have many Ajax calls -- let say, one per second --, but results would come far later)

I read the https://github.com/1000hz/bootstrap-validator/issues/145 issue, but i my case it is not possible: I want to check if a part exists in a nomenclature (a part composed of parts, themselves composed of parts, ...). This needs recursive calls over more than 500 000 parts... so doing a remote check while the user is typing is not an option, it takes more time for the server to check :)

In that case, the best way should be to only check the data at the end, on the form submission (with an Ajax call that send the validation and get the result), and mark fields as erroneous, if any.

So, to my mind, It would be great if we could trigger an error for a specific field manualy :)