sp-dev-fx-property-controls
sp-dev-fx-property-controls copied to clipboard
PropertyFieldCollectionData checks custom error messages for fields that are not required
Category
- [ ] Enhancement
- [x] Bug
- [ ] Question
Version
Please specify what version of the library you are using: [3.6.0]
Expected / Desired Behavior / Question
If a field has not been set to required onGetErrorMessage should not be called. When a former required field is no longer required it should be enough to set required to false and not also be necessary to remove the onGetErrorMessage setting.
Observed Behavior
I minor issue i noticed while browsing the code to find a fix for https://github.com/pnp/sp-dev-fx-property-controls/issues/446: In CollectionDataItem.tsx checkRowIsValidForSave calls checkAnyFieldCustomErrorMessage to verify that all inputs are valid. checkAnyFieldCustomErrorMessage does not check if the fields are required it just checks the error messages for all fields which results in unexpected behavior (rows not valid even when all required fields have been filled).
Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.