3 ms·
If you use a Rails helper to create a checkbox it puts a hidden field next to it with the "off" value to ensure something always gets POSTed back. I assume othe
by speleding 2y ago
If you use a Rails helper to create a checkbox it puts a hidden field next to it with the "off" value to ensure something always gets POSTed back. I assume other frameworks do the same. If you put a <label> element around those two input fields, it's no longer valid HTML.
This is not a problem for radio buttons, but I suspect a few people have been bitten by this and do it "just to make sure". In the same way, adding a semi-colon at the end of a line of JavaScript is rarely useful but people put them everywhere because they don't know when it's needed exactly (granted that one is a bit tricker to remember).