🐛 - Fix 1655- Dynamic form should not display any validation errors until the user clicks Save/Submit, or leaves the focus of a required control - (Repo Rescuer Challenge) #1963
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.
What's in this Pull Request?
Fixing issue #1655
Observation
When loading a Dynamic Form with no list item id (new item), the form should not display any validation errors until the user clicks Save/Submit, or leaves the focus of a required control.
Actual behavior
When loading a Dynamic Form with no list item id (new item) all of the required fields display validation errors by default.
Solution
In
DynamicField.tsx
component, individual field is set and the validation is done through the methodsgetRequiredErrorText()
andgetNumberErrorText()
These methods currently are only checking with
changedValue
property, which will be always empty for a new item. An additional check is done on basis oflistItemId
assuming that the fact that for new item, this will be empty, we can achieve to not to show the validation errors on the form.Screenshots
Observed
After change
Edit scenario
Thanks,
Nish