You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 2, 2024. It is now read-only.
I have a form with about 10 different fields. The options for two select fields (lets call them color and model for example) are dependent on the value of another field (say make). I'm currently able to change the options given to the selects based on the value of the field. My problem is that I can't find a good way to set the current selected value of color or model whenever the make is updated. I know that I could break encapsulation, inspect the update message, and, when the make changes, set the selected color and model to defaults/selected by calling initialize again and using the getFieldAsString for all of the fields and substituting the appropriate values in the list. However, this not a desirable approach. Is there a good way to achieve this kind of functionality? Thank you for any guidance! If there's a general feature to work on here, I would also be willing to take a crack at implementing it and submitting a PR.
The text was updated successfully, but these errors were encountered:
Hi,
The only way I see is to add a kind of post-update step where you take the form as input, look at fields, do the update and re-validate if needed. That would add a bit of boilerplate, but I don't see any better way at the moment. A space that needs exploration!
Hi,
Sorry for the response delay. Re-initialize would be too much, just setting a field by generating and applying the message for field update, Input String InputType FieldValue in Form.Msg. Might be a bit verbose I fear.
I have a form with about 10 different fields. The options for two select fields (lets call them
color
andmodel
for example) are dependent on the value of another field (saymake
). I'm currently able to change the options given to the selects based on the value of the field. My problem is that I can't find a good way to set the current selected value ofcolor
ormodel
whenever themake
is updated. I know that I could break encapsulation, inspect the update message, and, when themake
changes, set the selectedcolor
andmodel
to defaults/selected by calling initialize again and using the getFieldAsString for all of the fields and substituting the appropriate values in the list. However, this not a desirable approach. Is there a good way to achieve this kind of functionality? Thank you for any guidance! If there's a general feature to work on here, I would also be willing to take a crack at implementing it and submitting a PR.The text was updated successfully, but these errors were encountered: