Closed grivescorbett closed 9 years ago
Something similar was requested in issue #68 and pull request #75.
The latter would allow you to build a custom validator that has access to the entire form and which you could bind to a hidden addresses
input field (with no value). Not sure though how you'd properly display constraint violations for that field...
I would use a hidden input field. Validators are only called on existing fields, therefore, there would always be the need for an input field, even when referencing the whole form in a custom validator. This is far more complex, than using an input field, which solves this by just adding a single line.
I discussions like this one should never forget that client-side validation is only about convenience, UX-sugar if you will. So, I feel that even if you can only validate 80% of your constraints on the client and the rest is validated exclusively on the server you achieved a lot.
I'll close this as we have a feature request that would make this possible in #68. As mentioned in #75 we currently focus on single field validation until someone comes up with a good idea how to access all form values and make cross-field validation possible.
An example would be "A person must have at least 3 addresses." I'd like to be able to lay out the constraints like so:
There is no
<input>
element for theaddresses
array but it still has constraints against it. Is this currently possible with valdr? If not, is there interested in a feature like this?