Re: using QuickForm with $_GET variable for default id - when it processes there is no variable in URL so it throws error
| From: | l Burnerheimerton | Date: | Fri, 07 Jan 2005 16:02:29 +0000 |
| Subject: | Re: using QuickForm with $_GET variable for default id - when it processes there is no variable in URL so it throws error | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-16787@lists.php.net to get a copy of this message | ||
This is what I ended up using:
function preGenerateForm() {
$this->fb_preDefElements['plot_ID'] =
HTML_QuickForm::createElement('hidden', 'plot_ID',
$_REQUEST['pl_ID']);
$this->plot_ID = $_REQUEST['pl_ID'];
"I. M. Bur" <buralien@gmail.com> wrote:
> > .... element definition ...
>
> If you want the ID to persist, set up a hidden element in the form
> (this is probably your problem).
>
> $form->addElement('hidden', 'ident', $ID);
It's not the first time someone makes this mistake. addElement() does
not take the element's value as one of the parameters. Instead you
have to use setValue() or setDefaults() afterwards. I would really
like to set it's value like this, but it is simply not the case.
See here:
http://pear.php.net/manual/en/package.html.html-quickform.html-quickform.addelement.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
--
PEAR General Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com