onGetErrorMessage for properties should not auto-revert back to last OK value
Category
- [x] Bug
- [x] Enhancement / Suggestion
Expected or Desired Behavior
When I have a text property to my web part and would like to validate it, in some cases (most cases I used) having the onGetErrorMessage is useless. Seems when onGetErrorMessage reports an error message, the value the user entered is reverted back to the last known good value as soon as you leave the field.
Scenario: Say your property validates a text field that must contain 'a'. type in 'a', leave it. next, type in 'b', you will see the error message as expected.
- as soon as you leave the text field, it will be reverted back to 'a'. Imagine this scenario: I have a drop down: "Text must start with:" and user can select 'a', 'b','c'. I have a text box: "Text" that validates value must start with what ever was selected above. User changes value from 'a' to 'b', see validation error message. He wants to change the drop down to 'b' but he loses the value he entered in the text box.
Also, If i want to use a PropertyPaneButton to validate them and set the error on one/more values, and re-validate and clear the error message after the user corrected the input and clicked the button again it is impossible, since every time the user change the values they will be back to last good known value.
We need to be able to disable this functionality, and prevent the validation error from changing the property value back to what it was.
Observed Behavior
As soon as I leave the text box to try and change the drop down to 'b', my text is lost.
Thanks for the feedback @shaipetel. We are investigating this issue.
Cleaning up old github issues. This appears to no longer be the case. If I follow https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/guidance/validate-web-part-property-values , when I get an error message, it remains, and the property value no longer changes.
Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues