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

Opportunities to set one model value based on another? #55

Open
stephenwil opened this issue Apr 30, 2018 · 0 comments
Open

Opportunities to set one model value based on another? #55

stephenwil opened this issue Apr 30, 2018 · 0 comments

Comments

@stephenwil
Copy link

I have the scenario where I want to set one model value based on some computation of another model value.
A phone preference type ('Mobile', 'Work', 'Home') and a mobile phone number.
Both values are optional, and therefore could be blank.
If the mobile phone number is complete and valid, I want the phone preference to be set to 'mobile'.

If I want to do this on the blur of the mobile phone field - I can't. Why:
a) I can override the onBlur of the mobile phone field over Form-containers' but I'd have to replicate what form-container is doing, as it's not exposed on the interface to call it.

b) Although the form-config allows a 'global' onBlur event, it's outside the implementing class, and therefore has no access to the model etc.
I could have used 'getValue()' but that's not exposed on the interface.

c) I can override the onChange event, and then call form-containers' one, but the model on the props doesn't reflect the update of the model, validation etc that may happen when form-containers' is called. (It's one cycle behind).

There's no real opportunity to achieve the above unfortunately.

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

No branches or pull requests

1 participant