Skip to content
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

Support for dependent property validation #20

Open
MaximBalaganskiy opened this issue Jul 26, 2016 · 4 comments
Open

Support for dependent property validation #20

MaximBalaganskiy opened this issue Jul 26, 2016 · 4 comments

Comments

@MaximBalaganskiy
Copy link

The use case is a registration form where a password and a confirmation are entered. When the password is changed the confirmation should also be validated to match the new password value

@grofit
Copy link
Member

grofit commented Aug 3, 2016

This may require something like a dependsOn method which would allow you to imply that when a dependent property changes it would refresh this one. It needs a bit more though but there is a matches rule which is a part of what you need, where you can make sure something matches another property, but it just wont refresh as you want.

Anyway will chat with some of the others about dependsOn("someProperty); or revalidateWith("someProperty"); as an option.

@MaximBalaganskiy
Copy link
Author

As an option, I can use a fake rule on password property which will just trigger validation on confirmPassword property. Haven't tried it yet, but seems like a solution

@grofit
Copy link
Member

grofit commented Aug 4, 2016

for now that may be a work around but it is a valid feature request, I just need to think about how best to handle it.

@grofit
Copy link
Member

grofit commented Aug 4, 2016

There are some other quirks around this that need thinking about, from an intent perspective it is easier to have the notion of dependent properties so that way you can check when validating a given property what other properties need to be triggered for re-validation. However you could enter into a circular reference here where you could technically have 2 properties both depending on each other.

Also currently it seems to make sense to make this happen only on changes not on explicit validation, as if you are doing that you will be re-validating everything anyway so it seems pointless to trigger dependencies there as nothing could change once the validation starts (I think off top of my head).

Finally at first pass it would seem that this should be something stored against a rule link, however as a property can have multiple rule links it would mean you would end up having to do the triggering at the rule link level not the property level, allowing people to trigger the same property multiple times etc. So it may actually need an entirely new notion which stores the property dependents at the property level not the rule level.

Ultimately it needs a lot more thought around how it would all hook together, but I think we all know what we want it to do, just how best to make it happen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants