pnp / pnp/sp-dev-fx-controls-react

TaxonomyPicker validate empty value if required is set to true

Open
#1,351 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

help wanted type:enhancement
Dominant language
TypeScript
Stars
433
Forks
418
Avg merge
5d 6m
Merged PRs (30d)
19

Description

Thank you for reporting an issue, suggesting an enhancement, or asking a question. We appreciate your feedback - to help the team understand your
needs please complete the below template to ensure we have the details to help. Thanks!

Please check out the documentation to see if your question is already addressed there. This will help us ensure our documentation is up to date.

Category

[x ] Enhancement

[ ] Bug

[ ] Question

Expected / Desired Behavior / Question

If you set required property to true on TaxonomyPicker the validation schould occur and call onGetErrorMessage,

Observed Behavior

Right now required property is only for showing asterisk on label.

Steps to Reproduce

<TaxonomyPicker
allowMultipleSelections={false}
termsetNameOrID="guid"
panelTitle="Title"
placeholder="Pick"
label=""
required={true}
onGetErrorMessage={(value: IPickerTerms) => {
return errorMessage;
}}
context={spfxContext as any}
onChange={(val) => {
console.log(val);
item.tegund = val;
}}
initialValues={[]}
validateInput={true}
validateOnLoad={true}
/>

TaxonomyPicker is added to onRender and errorMessage is static string with just error text.
onGetErrorMessage never launches when control is loosing focus etc.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the TaxonomyPicker implementation and its handling of required, validateInput, validateOnLoad, and onGetErrorMessage. Reproduce the provided empty-value example and trace what happens when the control loses focus. Done means required empty values trigger the supplied validation callback as expected.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.