Can CSS be used to disable form fields? I'm aware of the attribute disabled, of course, but can I define it in a CSS rule? Something like -
<input type="text" name="username" value="admin" >
<style type="text/css">
input[name=username] {
disabled: true; /* Does not work */
}
</style>
I'm asking because I have a program whose form fields are automatically produced and whose rules determine which fields should be hidden or displayed (which runs in Javascript). I now want to expand it to support disabling and enabling fields, however, the rules' current format directly modifies the form fields' style settings. Now that I have to alter the rule engine to change form field properties and styles, it doesn't seem ideal.
That you have visible and display attributes in CSS but can't enable or disable them is quite odd. Exists a similar feature in the HTML5 standard, which is currently being developed, or perhaps something non-standard (browser-specific)?