sp-dev-fx-controls-react
sp-dev-fx-controls-react copied to clipboard
DynamicForm Bug with PeoplePicker (one person)
Category
[ ] Enhancement
[ X] Bug
[ ] Question
Version
Please specify what version of the library you are using: [3.20 ]
Expected / Desired Behavior / Question
Observed Behavior
When using DynamicForm's fieldOverrides with a PeoplePicker control with when you save the record the user field will remain blank. There are no errors thrown. The issue is when calling the onChanged event in the switch case 0 block the line if (!(newValue[0].id === undefined || parseInt(newValue[0].id, 10).toString() === "NaN")) return [3 /break/, 2]; will result in not(false) = true when a user is populated which will return [3 /break/, 2] therefore leaving the user blank when saved.
I changed the line to this if (newValue[0].id === undefined || parseInt(newValue[0].id, 10).toString() === "NaN") return [3 /break/, 2]; which resolved the issue and now the user is saved.
Steps to Reproduce
- Make sure your list has a User field for one person only.
- Create a SPFx Form Customizer extension solution using REACT.
- Install @pnp/spfx-controls-react
- Use the DynamicForm control and use fieldOverrides to create your own PeoplePicker control (personSelectionLimit=1).
- Deploy or run in workbench and enter a user and click Save. The form will save but the User field will be blank.
Thank you for submitting your first issue to this project.