jqBootstrapValidation icon indicating copy to clipboard operation
jqBootstrapValidation copied to clipboard

Dynamic Rules - Doesn't really destroy

Open fobus42 opened this issue 10 years ago • 1 comments

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?

fobus42 avatar Aug 24 '15 06:08 fobus42

I have the same problem. Did you found the solution?

gabrielibis avatar Mar 03 '21 16:03 gabrielibis