Sp-dev-docs: PropertyPaneTextField - onGetErrorMessage with Promise is clearing TextField value

Created on 17 Nov 2020  Â·  6Comments  Â·  Source: SharePoint/sp-dev-docs

If you add onGetErrorMessage which returns a Promise of an empty string (i.e. it passes validation), the value of the TextField is cleared when you click or Tab away (blur) from the TextField.

Sample Code:

protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration {
  return {
    pages: [
      {
        header: {
          description: strings.PropertyPaneDescription
        },
        groups: [
          {
            groupName: strings.BasicGroupName,
            groupFields: [
              PropertyPaneTextField('description', {
                label: strings.DescriptionFieldLabel,
                onGetErrorMessage: (): Promise<string> => {
                  return Promise.resolve('')
                }
              })
            ]
          }
        ]
      }
    ]
  };
}

Results:
Demo


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

docs-comment spfx-general to-be-reviewed

Most helpful comment

Thanks all for the repro. We've identified the break and have a fix.

All 6 comments

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

I can also confirm that I am seeing this issue in LinksAndHandlebarsTemplate web parts which is currently in production in multiple tenants.

I also seeing a similar behaviour with the out of the box Document Library web part, specifically the Folder property.

Validation works for a entering an incorrect value, but when entering a valid value, it disappears.

libraryissue

Thanks all for the repro. We've identified the break and have a fix.

Ok, great me and my customer are waiting for this very welcome fix as well, keep us in the loop, thx!

Yes true. Pls keep us posted with the solution.

Was this page helpful?
0 / 5 - 0 ratings