Re: Some simple quickform question.
| From: | Bertrand Mansion | Date: | Sun, 11 Aug 2002 12:16:46 +0000 |
| Subject: | Re: Some simple quickform question. | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-2085@lists.php.net to get a copy of this message | ||
<tarjei@nu.no> wrote :
> Hi, I'm just starting to learn how to use the Quickform package, and I got a
> few
> questions:
>
> 1. CSS
> How can I add class="something" to different elements?
> I need to set this.
Use $form->addElement('text', 'NAME', 'Your name:',
'class=mycss');
The 4th parameter of this method is your html attributes. As class is an
html attribute, you can use it here. You could also use:
$form->addElement('text', 'NAME', 'Your name:',
array('class'=>'mycss'));
> 2. $form->addElement('button', 'actionID', 'something');
> How do I use the third arg in addElement? Is this an array? i.e:
> $array = ('value'=>'5', size=>4);
> $form->addElement('button', 'actionID',$array);
> and then you got it?
Usually, the third argument is the label of your element.
The fourth argument are the attributes. You can use whatever attributes you
want and define in an array or in a string. Choose whichever method fits you
best.
Bertrand Mansion
Mamasam