-
Notifications
You must be signed in to change notification settings - Fork 43
Validate one input against another #68
Comments
Right now there is no way to validate one field against another one. This is because the directive that validates one input has no access to the complete form, to read the other fields values from. |
I need this too, a way to add cross-field validation. Thanks! |
I too would like this feature implemented. @philippd Could you provide some guidance in how this feature would be implemented? If it's relatively simple to implement. I'd like to try getting it implemented. |
…requires testing and docs.
I've sent a PR with this feature implemented, but i couldn't think in a way of testing it automatically... I'm not very familiar with jasmine and frontend testing so I would really appreciate suggestions! |
Hi guys, this is a way to implement the validation against another field, at least it was the workaround in my case: 1 ) Define the extension
'passwordMatch':{ Hope it helps. |
Not really an optimal/scalable solution to use jQuery for this imo, has anyone thought about this further? Trying to implement a password match validation as well currently, not sure what the best way to do that with Valdr is |
@tyronedougherty I'm using the fork I made of valdr in production and it's working like a charm. I made a PR to this repository but it was never accepted :( |
Oh, I also added async validation in my fork. But I didn't document how to use and didn't test it a lot, so it may be bugged. The sync validation still works even with the async validation code though. |
@hugobessa huh that is strange. I'll give it a go! 👍 |
Would there possibly be a way to validate one input against another and specify it in the JSON (without an angular directive in the html)? Below I am using ng-required, which gives me the correct functionality. Only issue is I'd like to give it that logic in the JSON coming from our Java backend instead of in the html.
I'm attempting to create a custom validator that works with the following structure:
In the custom validation service, I have access to the value, and the arguments. Do you know how I might use the strings in my JSON to refer to the other input value? Or is there a better way to achieve this? I'd really appreciate any feedback or direction. Thanks for the great library!
The text was updated successfully, but these errors were encountered: