jqBootstrapValidation
jqBootstrapValidation copied to clipboard
Dynamic Rules - Doesn't really destroy
Hello,
I'm trying to use this plugin in dynamic forms. I have two fields. First fields value effects on the seconds validation rules. Both fields are text boxes and accepts integers
For Example
if FirstField < 0 then SecondField Required if FirstField > 0 then SecondField Required
I have write the conditions on FirstFields change event. I'm checking the FirstFields value and add or remove "reqired" property to the seconds ex: $('#SecondField').prop('required',null);
Then I'm destroying Validator
$("input,select,textarea").jqBootstrapValidation('destroy')
//recreating validator. $("input,select,textarea").jqBootstrapValidation()
Problem starts here; When I check if there is an error. $("input,select,textarea").jqBootstrapValidation('hasErrors')
it allways returns true, because recent configuration was having "required" but it is currently it doesn't have a required propery.
What is expected; Every time after destroy and recreate validation, it needs to load the last configuration and give the correct result on "hasErrors" call
How to reset to the last configuration?
I have the same problem. Did you found the solution?