question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Submitting empty values

See original GitHub issue

I am having an issue submitting empty values for fields on an update form. For example, if I have a simple field: <Text type="number" field="pay_amount" id="pay_amount" /> And, it’s initially loaded with a value, which works just fine. However, if I remove the value so that the field is now blank (which is what I want to send to the backend) the object that is passed to the onSubmit handler does not contain that field. Now, if I have a field that initially loads as blank/empty and it’s never touched, the onSubmit handler sees that field with a value of null, which is what I expect for the former example. Any guidance on how to get those empty values into the form submit? Thanks! And many thanks on a great form component!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:16 (9 by maintainers)

github_iconTop GitHub Comments

3reactions
joepuzzocommented, Apr 4, 2019

Just released!! 2.3.0 there are two new props allowEmptyStrings <<< Form level prop && allowEmptyString <<< field level prop

1reaction
joepuzzocommented, Mar 28, 2019

I was saying that the allowEmptyString prop would allow the user to set initialValue to '' and also when the backspace it would not remove and instead be ''

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to prevent submitting the HTML form's input field value if ...
Show activity on this post. I have HTML form with input fields. Some of inputs can be empty, i.e. the value is ""....
Read more >
Submit form doesn't work if you empty a value
Hi guys, Quick bug I discovered: If I open a Sharepoint item via a Form and one of the fields, I delete the...
Read more >
JavaScript : HTML form - Checking for non empty - w3resource
The following function can be used to check whether the user has entered anything in a given field. Blank fields indicate two kinds...
Read more >
Empty form values are not included on submit #430 - GitHub
Are you submitting a bug report or a feature request? ... Empty form values and pre-selected options are not included in the submit...
Read more >
Form input values are empty after submit
Everything is working except when I submit the form and refresh the page it shows me for example 3 inputs but with empty...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found