-
-
Notifications
You must be signed in to change notification settings - Fork 175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Array validation misapplied #333
Comments
* Fixed proengsoft#333 * Updated jsvalidation.min.js
I have the same issue the form request array does not appear on javascript code it's empty and the fixes don't work for me. im using laravel 5.5.4 |
@maganius please provide a test case, the fix works fine for the case I wrote above |
I have selects such as: In the FormRequest validator
I tried change the RegExp and The first select is static but I have a button to add more select dynamically |
Laravel: 5.5.40
jsvalidation: latest
Support to validate array fields using non array rules was added in 4bf612a under #206
I have inputs such as:
<input name="emails[0][id]" type="hidden" value="">
<input size="30" name="emails[0][address]" type="email" value="" id="emails[0][address]">
Which is validated with:
'emails' => 'required_if:parent,0|nullable|array'
The
emails
rule is getting applied to both elements above, because oflaravel-jsvalidation/resources/assets/js/helpers.js
Line 352 in 00c0fad
^emails\[.*\]$
and matches both of the above elements.I don't expect the
emails
rule to be applied to all children. I suspect, it's a special case as it was introduced to cater for: #180. With this in mind, the regex should beso it only matches single dimensional arrays. At the moment the greedy quantifier means it's matching
[0][id]
The text was updated successfully, but these errors were encountered: