Skip to content

Empty (null/undefined) properties are not submitted in SelectArrayInput, SelectInput, DateInput #10679

Open
@yonitou

Description

@yonitou

What you were expecting:
When I have a SimpleForm, every key/value couple that is present in the form must be present in the final object when submitting it

What happened instead:
For some kind of inputs : DateInput, SelectArrayInput, SelectInput, if the input has not been touched (is not dirty), the key is not present in the final object.
I tried to use parse, format, sanitizeEmptyValues, transformOptions, defaultValue, none of them worked. I don't know in which version the issue appeared but I know that it was working before.

Related code:

<SelectInput
	choices={[{id: 1, name: "test"}, {id: 2, name: "test2}]}
	label="resources.usages.fields.doseIsCheck"
	source="doseIsCheck"
/>

When using a simple SelectInput like this one, if I'm not "touching" the input, the key doseIsCheck won't be present when submitting the form. I didn't customize any parent component like Create or SimpleForm. It's really boiler plate code

Environment

  • React-admin version: 6.5.4
  • Last version that did not exhibit the issue (if applicable): Hard to say :/
  • React version: 18
  • Browser: Safari

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions