Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PeoplePicker validation bugfix #1221

Merged
merged 3 commits into from
Jun 23, 2022
Merged

Conversation

HardluckHalvey
Copy link

@HardluckHalvey HardluckHalvey commented May 23, 2022

Clear error message when onGetErrorMessage() returns empty string

Q A
Bug fix? [X ]
New feature? [X ]
New sample? [ ]
Related issues? fixes #X, partially #Y, mentioned in #Z

What's in this Pull Request?

Update to the validate function to handle the props.onGetErrorMessage returning an empty string. Addresses issue with people picker not clearing error message after passing validation after displaying an error message.

Update to add support for validateOnFocusOut

Guidance

  • You can delete this section when you are submitting the pull request.
  • Please update this PR information accordingly. We'll use this as part of our release notes in monthly communications.
  • Please target your PR to dev branch.

AJIXuMuK and others added 3 commits May 9, 2022 12:19
@joelfmrodrigues joelfmrodrigues changed the base branch from master to dev June 3, 2022 21:45
@joelfmrodrigues
Copy link
Collaborator

@HardluckHalvey many thanks for the great improvements and sorry for the late reply.
I have updated the PR to target the dev branch.

Also, while reviewing and testing, the onBlur change seems to introduce a small issue. When I select users, the on change event returns an array with the selected users; but when I click outside of the field and click back on the field again, the onChange will return an empty array. If I then select another user, it returns again an array with the correct users. It seems to always return an empty array when clicking back on the field. Can you please investigate?

Regarding removing the error message when validation passes, all seems to be working fine.

@HardluckHalvey
Copy link
Author

Sorry about that - I'll make sure to target any future PRs to target dev. I'll have a look at the onBlur issue this weekend. Thanks!

@joelfmrodrigues
Copy link
Collaborator

@HardluckHalvey just checking if you need any help with the issues?

@HardluckHalvey
Copy link
Author

Hi Joel,

I'm having some trouble with reproducing the issue described - when I utilize the validateOnFocusOut property alongside passing in a method for the onGetErrorMessage property, the PeoplePicker seems to work as intended, only firing the onChange once. Can you provide an example of how you're calling the PeoplePicker - it will help in my investigation of the PeoplePicker clearing when clicking back into it after entering some data into it.

@joelfmrodrigues
Copy link
Collaborator

Hi @HardluckHalvey

Previously I was able to recreate the behaviour I described consistently...this was just by adding the new property to the test controls on the test web part of the solution and it would happen every time following the pattern described. I even saved the changes to test as a stash so I could retest again easily...
Now I just spent a lot of time clicking in and out of people pickers, trying all sorts of things, and I can't recreate it 😅 it's driving me mad 😅 maybe a browser thing, I don't know...

Will approve the PR as it seems to be working fine. Really sorry for the delay

@joelfmrodrigues joelfmrodrigues merged commit 1e0ab6c into pnp:dev Jun 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants