-
Notifications
You must be signed in to change notification settings - Fork 397
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
[Dynamic Form] Cannot Clean Up Date Field and Save it #1937
Comments
As I checked, the And it seems that only date field will has null value on newValue property when it get cleanup (I tested with taxonomy and lookup, they just return an empty array). I guess the condition check if (field.newValue !== null && field.newValue !== undefined) in
is like "defensive programming" to avoid code crash. We can just change this check to I can create PR for this issue (Maybe also make allowTextInput enabled as default for date field?) |
Hi @wuxiaojun514, Thanks for raising this. FYI this string conversion error is known and has been declared in #1923. Regarding the bug that prevents the date input to be cleared out, you're right it should be editable juste like it is in the native list form UI. Would you like to fix this? |
Hi @michaelmaillot , You can assign this task to me. |
Yes, but be sure that you'll cover the field validation, just as it is for a text field. |
Ok, I will double check the field validation when I enable |
I have raised the PR which also will enable allowTextInput property for date field I tested the change with several different other fields (taxonomy, lookup...) and I don't get side effect. But the "Column Validation" seems not work properly in Dynamic Form, it will always get triggered whenever the value it is. |
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 itIt 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,tsxHowever, 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
allowTextInput
propertyThe text was updated successfully, but these errors were encountered: