I have a checkbox which is updated from other selections but it is important to show the checked status to the user. However I also want it to be read only in functionality and represented as such in the display.
It works fine by disabling the checkbox (gives the greyed out box to assist the user visually) however this means upon submitting the value is not saved.
Conversely, if I set the checkbox to read-only it disables the checkbox but still appears like a normal checkbox.
I kinda want a bit from each, a checkbox that submits it's value but looks like a disabled checkbox and still displays its check status... does anyone have any ideas?
checked) { // Disable button when checkbox is selected submitButton. disabled = true; } else { // Enable button when checkbox is deselected submitButton. disabled = false; } }); Below, you'll find some examples of different ways to solve the Disable Submit Button Until Checkbox Is Checked Javascript problem.
Use a hidden field <input type="hidden" />
. Populate the hidden with the same values you would expect from the checkbox. This way the visual element is separate from the data element and you will not have these concerns.
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