Replies: 2 comments
-
So maybe I can rephrase and shorten my question: Is there a way to dynamically determine the validation state of a field depending on a condition that might depend on other fields? |
Beta Was this translation helpful? Give feedback.
0 replies
-
no longer relevant, I had to rephrase my question |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have the requirement to put an asterisk to a field label whenever this field is required
This doesn't pose any problem if the field is unconditionally required ... but I often have fields coming from dynamic form generation, where the user/form creator can decide to make the field only required if a certain condition is met (eventually depending on other field values, i.e. the field is ONLY required if the other field has a certain value).
Now, the required property doesn't allow to have a dynamic validation, therefore I added a "validate" property with a function returning either a string (if field is required and not filled) or true. Ideally, I would now show the asterisk on the field label, whenever this function will fail on submit
But, as mentioned, the validation is only run on submit, and not dynamically. So I cannot find a way to show the asterisk dynamically depending on the outcome of the (potentially failing) validation.
Is there any way to show the asterisk if the required/validate results change dynamically depending on values of other fields?
Beta Was this translation helpful? Give feedback.
All reactions