Skip to content

🐛 - Fixes-Issue 1953 - DynamicForm required User Fields not checked before submit (Repo Rescuer Challenge) #1965

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

Merged
merged 2 commits into from
Mar 14, 2025

Conversation

NishkalankBezawada
Copy link
Contributor

@NishkalankBezawada NishkalankBezawada commented Mar 11, 2025

Q A
Bug fix? [x]
New feature? [ ]
New sample? [ ]
Related issues? fixes #1953

What's in this Pull Request?

Fix for Issue 1953

Observation

Required field validation is not working for User field (both single and multi select) as in below screens

Issue+1953

Issue+1953-1

Actual behavior

Required field validation should work for all the fields.

Solution

Upon further investigation, I discovered that the value for an empty user field is [''], and the validation fails when attempting to verify isEmptyArray because the value.length is 1. The following method consistently fails

  private isEmptyArray(value): boolean {
    return Array.isArray(value) && value.length === 0;
  }

Including an additional userFields check as shown below

  private checkUserArrayIsEmpty = (value): boolean => {
    return Array.isArray(value) && value.every(item => item === "");
  }

which, in fact, verifies that each string in the array is empty, resuming the validation.

Verification

Issue+1953-2

Thanks,
Nish

@NishkalankBezawada NishkalankBezawada changed the title 🐛 - Fixes-Issue 1953 - DynamicForm required User Fields not checked before submit 🐛 - Fixes-Issue 1953 - DynamicForm required User Fields not checked before submit (Repo Rescuer Challenge) Mar 11, 2025
@NishkalankBezawada
Copy link
Contributor Author

NishkalankBezawada commented Mar 11, 2025

Hey @michaelmaillot @joaojmendes,

All set for your review.

Thanks,
Nish

@AJIXuMuK
Copy link
Collaborator

hey @NishkalankBezawada there is a conflict after merging your last PR.
Could you please resolve it?

Thanks!

@NishkalankBezawada
Copy link
Contributor Author

hey @NishkalankBezawada there is a conflict after merging your last PR.

Could you please resolve it?

Thanks!

On it now 💪

@NishkalankBezawada
Copy link
Contributor Author

hey @NishkalankBezawada there is a conflict after merging your last PR. Could you please resolve it?

Thanks!

Hey @AJIXuMuK

Thanks for your review and suggestion.

I have now resolved the conflict accordingly.

Thanks,
Nish

@AJIXuMuK AJIXuMuK merged commit 84b5b47 into pnp:dev Mar 14, 2025
1 check passed
@AJIXuMuK
Copy link
Collaborator

Thank you!
Merged!

@AJIXuMuK AJIXuMuK added this to the 3.21.0 milestone Mar 14, 2025
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.

2 participants