Re: QuickForm and hidden element
| From: | Mos | Date: | Thu, 11 Nov 2004 17:14:51 +0000 |
| Subject: | Re: QuickForm and hidden element | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-15447@lists.php.net to get a copy of this message | ||
"I. M. Bur" <buralien@gmail.com> a écrit dans le message de
news:76738b9904111108525215e993@mail.gmail.com...
> > I try to set up a form with QuickForm, but I have a problem with hidden
type
> > field
> >
> > I set in the script
> > $form_comment->addElement('hidden', 'abc', 50 );
> > and
> > $form_data.abc.html
> >
> > I should have : <input name="abc" type "hidden"
> > value="50" />
> >
> > But I have nothing instead.
>
> The third argument is not the one that sets the value, its for
> additional attributes of the <input> tag. You have to set the value
> using the setValue() method, or using setDefaults() method on the form
> itself...
>
>
http://pear.php.net/manual/en/package.html.html-quickform.html-quickform-hidden.html-quickform-hidden.php
>
http://pear.php.net/manual/en/package.html.html-quickform.html-quickform-element.setvalue.php
>
http://pear.php.net/manual/en/package.html.html-quickform.html-quickform.setdefaults.php
>
> --
> I. M. Bur
> buralien@gmail.com
yes... why not, but in the documentation (first link above), I read :
void constructor HTML_QuickForm_hidden::HTML_QuickForm_hidden ([string
$elementName = NULL [, string $value = '' [, mixed $attributes = NULL]]])
1/ string $elementName
(optional)Input field name attribute
2/ string $value
(optional)Input field value
3/ mixed $attributes
(optional)Either a typical HTML attribute string or an associative array
Furthermore, I use the addElement method so I have to indicate the type of
element tot add through the first parameter...
I guess setDefaults works fine when using create method, but I just want to
know how to use it.
In the well-done QuickForm guide at
http://www.thelinuxconsultancy.co.uk/quickform.html
the author indicates :
$form->addElement('hidden', 'code', 123454) creates a code like : <input
name="code" type="hidden" value="123454" /> (page 9)
So I stay on my first question : how to use the addElement with hidden
fields ?
Mos