Re: AW: [PEAR] [QuickForm] Change look of freezed objects
| From: | Justin Patrin | Date: | Fri, 10 Dec 2004 18:41:01 +0000 |
| Subject: | Re: AW: [PEAR] [QuickForm] Change look of freezed objects | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-16162@lists.php.net to get a copy of this message | ||
On Fri, 10 Dec 2004 11:29:07 +0100, Mirco Blitz <webmaster@lindworm.de> wrote:
> Hello Justin,
> thank you for your answer.
>
> When I use the array('disabled' => 'disabled') directly in side the
> checkbox
> declaration like in the following, it works fine.
> $form->addElement('checkbox','r_ben_anl','Benutzer
> anlegen','',array('disabled' => 'disabled'));
>
> But I also tried to set the attribute later, to have a nicer code and no if
> clauses between the elemt declaration. The nothing is displayed at all.
> This is my function for setting the attribute later. I think that one is
> wrong.
>
> function disable($name)
> {
> global $form;
> $el =& $form->getElement($name);
> $el->setAttributes(array('disabled' => 'disabled'));
> }
>
Where are you calling this function? Have you checked the HTML to make
sure it's just not broken or hidden somehow? What does a print_r() of
$el show before and after setting the attribute? How about the whole
form?
> Thank you very much for your help.
> Mirco Blitz
>
> -----Ursprüngliche Nachricht-----
> Von: Justin Patrin [mailto:papercrane@gmail.com]
> Gesendet: Donnerstag, 9. Dezember 2004 22:47
> An: Mirco Blitz
> Cc: pear-general@lists.php.net
> Betreff: Re: [PEAR] [QuickForm] Change look of freezed objects
>
> On Thu, 9 Dec 2004 17:57:18 +0100, Mirco Blitz <webmaster@lindworm.de>
> wrote:
> > Hello,
> >
> > sometime ago I Asked how to disable checkboxes inside a QF Form.
> > You answered that I have to freeze them.
> > Now I see the form field like this [] or [x].
> > I want to have a disabled checkbox displayed.
> >
> > Is there a way of doing this. Change the Template or using another method
> to
> > disable?
>
> Perhaps...
> $checkbox->setAttributes(array('disabled' => 'disabled'));
>
> >
> > Thank you very much
> > Mirco
> >
>
--
Justin Patrin