Re: QuickForm problem
| From: | Cesare D'Amico | Date: | Fri, 02 Jan 2004 18:05:01 +0000 |
| Subject: | Re: QuickForm problem | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-9914@lists.php.net to get a copy of this message | ||
Alle 17:33, venerdì 2 gennaio 2004, Bertrand Mansion ha scritto:
> The validate() line looks weird here... But that's up to you, it
> depends whether you are validating the form before showing it or
> validating another form.
Why weird? (real question, no polemics). I'm a total newbie to QF, so
any hint is appreciated :)
I'm using validate() to decide whether I have to show the form [again],
or if I should update the db -- took that way of doing from an
introductory article on an Italian magazine.
> Did you try this instead ?
>
> $defaults = $tblSegn->recdData + array('azione' =>
> 'Modifica', 'id' => $_REQUEST['id']);
> $form->setDefaults($defaults);
> $form->addElement('hidden', 'azione');
> $form->addElement('hidden', 'id');
That way it works, thanks! :)
> > This works. If I change lines 3 and 4 to
> >
> > $form->addElement('hidden', 'azione', 'Modifica');
>
> Might be related to some other value overriding 'azione' value or
> REGISTER_GLOBALS stuff or something else. BTW, I recommend using
> setConstants() for hidden fields values.
Well, actually I used a constant ('Modifica'), not a variable, for the
element value, so I don't know how it could be overridden. I tried also
searching for 'azione' in the whole script, but I found nothing
harmful. 'azione' is a GET parameter given by a link (<a
href="...?azione=Modifica&...">).
Thanks again
ce
--
Cesare D'Amico - boss (@t) cesaredamico (dot) com
http://www.cesaredamico.com
To err is human, to forgive is not our policy.