Quick_Forms - Disable checkbox?
| From: | Ste | Date: | Fri, 26 Aug 2005 14:14:25 +0000 |
| Subject: | Quick_Forms - Disable checkbox? | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-20596@lists.php.net to get a copy of this message | ||
Hi All,
I'm trying to disable some check boxes on a form as a default when the
form is rendered. I'm trying to set the attribute to "disabled" but it
doesn't seem to get passed to the check box - at least it doesn't get
rendered into HTML with the disabled value. (Radio boxes seem to accept
attributes, as I can add an onclick event to my radio box to
enable/disable the check boxes as needed.)
What I have is:
$list_attrs = array ('disabled' => true);
$form->addElement('header', null,'Specific List(s)...?');
$list_options[]=&HTML_QuickForm::createElement('checkbox','own',null,'Items
I own',1, $list_attrs);
$list_options[]=&HTML_QuickForm::createElement('checkbox','notown',null,'Items
don\'t I own',1, $list_attrs);
$list_options[]=&HTML_QuickForm::createElement('checkbox','trade',null,'Trade
list',1, $list_attrs);
$list_options[]=&HTML_QuickForm::createElement('checkbox','wish',null,'Wish
list',1, $list_attrs);
$form->addGroup($list_options,null,null,' ');
The $list_attrs argument seems to be completely ignored. I tried looking
into the method, and I thought it should work.
The working code on my radio box is:
$attrs = array('onclick' => "javascript:enable_lists(this.form,1);");
$attrs2 = array('onclick' => "javascript:enable_lists(this.form,0);");
$form->addElement('header', null,'Which Lists...?');
$data_wanted[]=&HTML_QuickForm::createElement('radio', 'data', null,
'All Lists', 1, $attrs);
$data_wanted[]=&HTML_QuickForm::createElement('radio','data',null,'Specific
List(s)',2,$attrs2);
$form->addGroup($data_wanted,null,null,' ');
Any advice? (Other then coding JS for onload on the form - I'd rather
set the disabled in PHP...)
Thanks in advance
Ste