Skip to content

Commit 6c383cf

Browse files
committed
v2: fix of #841
1 parent 74d0d84 commit 6c383cf

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

src/controls/peoplepicker/PeoplePickerComponent.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,10 @@ export class PeoplePicker extends React.Component<IPeoplePickerProps, IPeoplePic
189189
if (typeof result === 'string') {
190190
if (!result) {
191191
this.validated(items);
192+
193+
this.setState({
194+
errorMessage: undefined
195+
});
192196
}
193197
else {
194198
this.setState({
@@ -202,6 +206,10 @@ export class PeoplePicker extends React.Component<IPeoplePickerProps, IPeoplePic
202206

203207
if (!resolvedResult) {
204208
this.validated(items);
209+
210+
this.setState({
211+
errorMessage: undefined
212+
});
205213
}
206214
else {
207215
this.setState({

src/controls/taxonomyPicker/TaxonomyPicker.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,10 @@ export class TaxonomyPicker extends React.Component<ITaxonomyPickerProps, ITaxon
454454
if (typeof result === 'string') {
455455
if (!result) {
456456
this.validated(value);
457+
458+
this.setState({
459+
errorMessage: undefined
460+
});
457461
}
458462
else {
459463
this.setState({
@@ -467,6 +471,10 @@ export class TaxonomyPicker extends React.Component<ITaxonomyPickerProps, ITaxon
467471

468472
if (!resolvedResult) {
469473
this.validated(value);
474+
475+
this.setState({
476+
errorMessage: undefined
477+
});
470478
}
471479
else {
472480
this.setState({

src/webparts/controlsTest/components/ControlsTest.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1144,7 +1144,14 @@ export default class ControlsTest extends React.Component<IControlsTestProps, IC
11441144
principalTypes={[PrincipalType.User, PrincipalType.SharePointGroup, PrincipalType.SecurityGroup, PrincipalType.DistributionList]}
11451145
suggestionsLimit={2}
11461146
resolveDelay={200}
1147-
placeholder={'Select a SharePoint principal (User or Group)'} />
1147+
placeholder={'Select a SharePoint principal (User or Group)'}
1148+
onGetErrorMessage={async (items: any[]) => {
1149+
if (!items || items.length < 2) {
1150+
return 'error';
1151+
}
1152+
1153+
return '';
1154+
}} />
11481155

11491156
<PeoplePicker context={this.props.context}
11501157
titleText="People Picker (local scoped)"

0 commit comments

Comments
 (0)