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

fix(form): Should support submit empty, ie. null values for non-required attributes. #836

Open
pbullhove opened this issue Nov 30, 2023 · 3 comments

Comments

@pbullhove
Copy link
Contributor

pbullhove commented Nov 30, 2023

If a number attribute is optional in form, then you cannot remove it. It submits 0 instead of null.

@eoaksnes
Copy link
Collaborator

eoaksnes commented Jan 3, 2024

@pbullhove what is this for?

@pbullhove
Copy link
Contributor Author

pbullhove commented Jan 4, 2024

@eoaksnes
Submitting optional numberField as blank does not send None/Null to DMSS, rather it sends 0.
Need a way to differentiate between 0 and No value.

Sumitting optional string sends empty string "", not Null.

Also for dimensional scalar, when it's not a primitive, we need to find a way to handle optional or not.

Solutions could be to have a null/none value in dmss.

@eoaksnes
Copy link
Collaborator

eoaksnes commented Jan 9, 2024

@pbullhove @collinlokken I think this is related to what Christopher is currently working on.

It will remove all primitive attributes from the payload that do not have any value.

How it is done: The NumberField and StringField will set the value to null to handle empty values. Then, the Form.tsx in the submit handler will set all values that are null to undefined, so that it is removed from the payload so that they will not be saved in the document. There reason why it is done this way, is that the controller does not support undefined.

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

No branches or pull requests

2 participants