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

[DynamicForm] Console error for empty values during onBlur #1949

Closed
michaelmaillot opened this issue Feb 7, 2025 · 1 comment
Closed

[DynamicForm] Console error for empty values during onBlur #1949

michaelmaillot opened this issue Feb 7, 2025 · 1 comment

Comments

@michaelmaillot
Copy link
Collaborator

Category

[ ] Enhancement

[x] Bug

[ ] Question

Version

Please specify what version of the library you are using: [3.20.0]

Expected / Desired Behavior / Question

When navigating through editable fields in the DynamicForm, there shouldn't be any error displayed in the console for empty fields.

Observed Behavior

When going back & forth in text fields, the following error is displayed:

Image

This is due to an attempt of using the toString() method for the newValue param which is null for some text fields (because defaultValue provided by the field structure is defined as null).

Steps to Reproduce

  1. Add the DynamicForm in a SPFx solution
  2. Configure it to target a list or library which have text fields without a default value defined (eg. null value, not empty string)
  3. In the UI, click inside a text field which have a default value defined as null, then click outside to leave the text field

Resolution proposal

Maybe updating the onBlur event in the DynamicField in order to test the defaultValue if empty OR null would solve the issue. But it has to be test against other field types that are refering to this event (dropdown for example).

Another fix could be in the DynamicForm class, in the onChange event, where the newValue should be evaluated first before being converted to a string value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant