Checkbox custom field <input> html element value always "true"

For custom checkbox field “Bonus”
why is the value attribute of html element always set to “true”, whether is it selected(checked), or not selected(unchecked). Shouldnt it be “false” when unchecked(deselected)?

when not selected(default value is “true”, which i think should be “false” by default)

when selected(default value is still “true”, which i think is actually correct for selected/checked checkbox )

1 Like

You are looking at the HTML. If this value is not set to true then the Bonus check box will not appear on the screen. Checking or unchecking is not part of this but part of the submission process.

I have noticed that whether selecting or deselecting, non of the event makes any changes to the html. Is that normal behavior?

@romangarg value attribute on checkbox doesn’t work the way you think it works.

See <input type="checkbox"> - HTML: HyperText Markup Language | MDN

Unlike other input controls, a checkbox’s value is only included in the submitted data if the checkbox is currently checked. If it is, then the value of the checkbox’s value attribute is reported as the input’s value, or on if no value is set.

1 Like

@lubos thank you so much for clarifying.