[BUG] A number component continues to submit the default value even after the input field has been emptied.
Environment
Please provide as many details as you can:
-
Hosting type
- [x] Form.io
-
Formio.js version: Default (sandbox option)
-
Browser: Google Chrome
-
Browser version: Version 111.0.5563.64 (Official Build) (x86_64)
Steps to Reproduce
- Create a new number component.
- Set a default value for the component.
- Clear the input field by removing the default value.
- Submit the form.
- Verify that the submission data does not contain the default value, but instead contains either an empty value (null or '') or the value entered by the user.
Expected behavior
I would expect to be able to override the defaultValue of a number component with an empty value. If I remove the value and leave the input field empty, the submission should have a value of null or an empty string ('').
Observed behavior
I have noticed that after clearing the input field so that it appears empty, and then clicking submit, the submission data still contains the defaultValue that was initially set, instead of being empty as expected. In my opinion, this is not the intended or desired behavior.
Example
A video example https://streamable.com/ykqi5j or use https://formio.github.io/formio.js/app/sandbox with sandbox code 64142732fa6be077d03185f5
Hello Kevin, I have reviewed your comment and I think that default value is meant to set the value of input element when no number is entered . So according to me it is not an issue but a feature. So it can be overridden only using a not null value.
Thank you for reporting this issue. I am able to reproduce and have logged a ticket for the backlog. We are always willing to review any contributions to resolve this issue from the open source community.
For internal reference: FIO-8149