How to use jQuery.validation in Checkboxes generated by jQuery.Repeater?

Asked

Viewed 31 times

2

I am using Dubfriend/jquery.Repeater to repeat some fields in a form, proengsoft/Laravel-jsvalidation to export Laravel validation rules, and jQuery.validation to validate them.

Checkboxes processed by jquery.Repeater, always receive a [] after the name.

The field in question is as follows:

<input name="ep_is_default" type="checkbox">

After Repeater is initialized the field gets this formatting:

<input name="group-prof_entities[0][ep_is_default][]" type="checkbox">

The rule expects a field with this name:

group-prof_entities[*][ep_is_default]

The difference is the [] in the name.

Any idea on how to solve this problem?

I tried to: - Manually delete "[]" and the rule worked. - Create a function to do this automatically and call it at Repeater startup, element duplication and copy deletion.

But element deletion fails because Dexes are recalculated and "[]" reinserted in the name of checkboxes.

Thank you.

  • Pedro, this is [en.so], so ask the question in Portuguese, please.

  • Translated, thank you

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.