Description
Category
[ ] Enhancement
[X] Bug
[ ] Question
Version
3.20.0
Problem Detail
I want to clean up the date field in Dynamic Form to set value to null.
By default, Dynamic Form doesn't support text input on date field, you need overwrite this field and enable allowTextInput property on DatePicker
control so you can type/clean the date on it
It worked at least one year ago.
Recently my team found that they cannot clean up date and it will throw error like Cannot read properties of null (reading 'toString')
The root casue is on OnChange
method in DynamicForm,tsx
However, if I modify the code from
field.stringValue = newValue.toString();
to
field.stringValue = newValue?.toString();
I still cannot save my cleanup, because its newValue is null and Dynamic Form will only add fields whose newValue is not null/undefined into changes. So my cleanup on date fields will never be submitted.
I will debug the Dynamic Form control deeply to understand the logic of this code.
Steps to Reproduce
- Make sure your list contains date field
- Override this date field in Dynamic Form to make sure the DateTimePicker enabled
allowTextInput
property - Test your form customizer with an existing list item and try to clean up this date field
- You should get the same error as I got.