Does anyone have a no JavaScript way to make HTML checkbox still submit a value? As in if you check it the form submission will include a value A but if it is uncheck it still contains a value B?
While I figure there isn't any way, I'm working on a site which needs to still be function when JS is off, and this would be ideal.
HTML checkboxes aren't supposed to work that way. If you check the checkbox, the definied parameter name=value pair will be sent. If you uncheck it, it will not be sent. In the server side you just have to check the presence of the parameter name (or value in case of multiple checkboxes in a named group) in the parameter map and handle accordingly. If present, then it's checked. If absent, then it's not checked. Simple as that. You already know the "unchecked value" in the server side.
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