validate with jquery.validate a form with dynamic elements divided into tabs

1

The problem I have is the following:

In twig from the form-wizard of the metronic template I dynamically create both the tabs and the elements within them. This first part goes well, the problem is in the validation. All the fields are obligatory and when I give it to the next button it only validates the first field and if the others remain blank, it goes over as if everything was fine.

If I click on each field, if it is shown as required and if I leave it blank I get the required field sign, but when I give the next button, if the first field is OK, remove the error and go to the next tab.

Does anyone have any ideas or solutions ???

    
asked by rlazom 26.05.2016 в 21:28
source

1 answer

1

The problem was the name of each element. The id made them unique when defining the elements:

id="anxAct{{ partida.id }}"

But the name did not define it; and among the documentation that I read from jquery.validate, it was that gives problems both when the id repeats and when the name repeats .

So I did the same with the name that with the id , and that's it; solved the problem. Now it validates all fields and does not pass to the next. I hope he serves someone and avoids wasting time with such a simple solution he had.

    
answered by 26.05.2016 в 22:18