Skip to content

PropertyPaneTextField - onGetErrorMessage with Promise is clearing TextField value #6479

@jimmywim

Description

@jimmywim

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.

Metadata

Metadata

Labels

Needs: Attention 👋Original poster responded to request for feedback, awaiting attention from Microsoft / community.area:docs-commentCategory: Comment left on bottom of a docs page here: https://docs.microsoft.com/sharepoint/devarea:spfxCategory: SharePoint Framework (not extensions related)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions