I'm pretty sure it's not possible to do this but I'm still asking for it.
Is there a way for a user to insert a null (or an undefined) value into an html text input?
I need to distinguish between a null value and an empty string and I would like to allow the user to set this value into a single input.
For what I can see across the web, the standard solution to this problem is to match the text input with a checkbox that tell if the value is null or not. From my understanding, the limitation is linked to the fact that the textbox can hold an empty string but not a null value so that's why I think it's not possible to do exactly what I want.
You can't tell a text input to have any kind of null
value. Empty checkboxes have a value of an empty string ''
by definition. The best way to do it, as you say, is to have a checkbox that toggles the disabled
property of the text input, which gives a similar semantic.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With