Wednesday, November 5, 2008

Disabled Form Elements in HTML are never submitted

Maybe I am too naive. But if a check box in a form is checked but disabled, it will never be submitted by the browser. This is what the W3 spec says "Disabled form controls are not successful" (Reference here). I am not sure if the Spec is correct in its design choice. But that's what it is.

A simple workaround to overcome this is to of course to add a hidden variable in the form with the same name as the check box. The hidden variable can contain the value that corresponds to a checked check box.