[WIP] Enable conditional validation of fields in DDF forms #7312
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is the implementation of the idea proposed here, basically allowing to use the same
condition
syntax that is already available when displaying/hiding fields. It is wrapping each validator in thevalidatorMapper
with the condition parsing that has been exposed for external usage.This would (partially) solve an issue in the IBM Cloud provider form where some fields would be not required if a dropdown is set to the right value. However, it doesn't deal with the visibility of
*
and some other aspects, so I am also considering to create a specialized wrapper component (with afields
attribute similarly to the validator) that would solve all the issues by altering the schema of the fields beneath.Even if I go with the other solution, this might be useful in other areas and so I'm leaving it here for discussion as a draft.