0
votes

I want to validate a repeatable text field in vee-validate. At least one row of inputs should be filled. How can I achieve such kind of validation?

Here is shown how my repeatable text field looks like in the browser. When I click "+" a new row with inputs is added.

enter image description here

I will be very grateful for any help.

1
Sure, that seems possible? What did you try? Seems that if you give each input a unique name and apply v-validate as you would normally, it will work. - Ryley
But these fields are generated dynamically. And I want also to ensure that at least one row of fields is filled. - Mikołaj Waśniewski
Please check out the Stack Overflow FAQ - This part specifically. I suggest additionally you prepare an example perhaps using this as a template: codesandbox.io/s/x4kp93w3o - Ryley

1 Answers

0
votes

You can apply the required rule only in the first row. If you have v-for in your code, you can use track-by="$index" to track the first row, and conditionally apply the rule.

However, I think if you add a code example, it would be really useful to others to help you.