Greying or disabling FORM components
|
|||
|
Rank: ? (4278)
Member #: 5260 |
How do I grey out or disabled a button or checkboxes?
It can be seen, but can't be clicked or checked, unless something else is done first. I am using HTML, PHP, and when necessary, JavaScript, to create a form, and PHP to interface the data entry or retrieve data with/from a MySQL database table.
Dreams are stories, but my life is just one bad dream. :P
|
||
|
|||
|
|||
|
Rank: ? (4821)
Member #: 3416 |
the xhtml-compliant way is to set the disabled attribute to "disabled" on the checkbox input element:
<input type="checkbox" disabled="disabled" /> if you don't care about xhtml and want to save a few characters, this will do the same thing: <input type=checkbox disabled>
my mind is like a steel trap! it only hangs on to the big stuff. visit my forums at track7.org
|
||
|
|||
|
|||
|
Rank: ? (4278)
Member #: 5260 |
Thanks for responding, misterhaan.
How would I do that interactively on webpage? Let say there are radiobuttons A and B. If A is selected, then checkbox C would be disabled. If B is selected, then checkbox C is enabled. Do I do this in PHP? Or would it be best to be done in JavaScript? » Post edited 2006-11-21, 12:38am by storyteller.
Dreams are stories, but my life is just one bad dream. :P
|
||
|
|||
|
|||
|
Rank: ? (4821)
Member #: 3416 |
that's probably best done with javascript, but also make sure to check the input on the php side in case someone has javascript disabled.
i'm not sure how you would toggle disabled using javascript, but i would expect an answer to turn up if you search for "javascript checkbox disable"
my mind is like a steel trap! it only hangs on to the big stuff. visit my forums at track7.org
|
||
|
Please login or register to post a reply.