- 
                Notifications
    You must be signed in to change notification settings 
- Fork 93
Open
Labels
bugSomething isn't workingSomething isn't workingrendererReact form renderer PRReact form renderer PR
Description
Scope: Form Renderer/FieldProperties
Description
The default behaviour of a form is to set a value to undefined when the user has cleared it. An API is provided to override this behaviour: https://www.data-driven-forms.org/schema/cleared-value. However, specifying clearedValue = "" is treated the same way as clearedValue = undefined, so that the field property does not appear in getState().values etc.
"" !== undefined, and I think it would be valid behaviour for a cleared text field to actually return an empty string as its value.
Schema
 fields: [
    {
      component: componentTypes.TEXT_FIELD,
      name: "field-with-empty-string-cleared-value",
      label: "Will be set to undefined when field is empty",
      clearedValue: "",
    },
    {
      component: componentTypes.TEXT_FIELD,
      name: "field-without-cleared-value",
      label: "Value will be undefined when field is empty",
    },
    {
      component: componentTypes.TEXT_FIELD,
      name: "field-with-other-cleared-value",
      label: "Value will be null when field is empty",
      clearedValue: null,
    },
  ],
Thanks!
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingrendererReact form renderer PRReact form renderer PR