Re: display of submitted values and an empty form on the same page using Quickform
| From: | Bjoern Mittelsdorf | Date: | Thu, 03 Aug 2006 13:21:12 +0000 |
| Subject: | Re: display of submitted values and an empty form on the same page using Quickform | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-24818@lists.php.net to get a copy of this message | ||
Thanks in advance Justin.
> setDefaults won't work as the values in the request will override the
> defaults. I would suggest making a copy of the form object before you
> freeze it, set the internal var with the submitted values to null
> (sorry, don't remember its name), and calling one of the functions
> which re-sets the values of elements (such as setDefaults()).
Copying the object sounds better indeed. But ...
if ( ( isset( $_REQUEST['manual'] ) ) && ( $newform->validate() ) ) {
$newer_form = $newform ;
$newform->removeElement( 'manual', TRUE ) ;
$newform->removeElement( '2)', TRUE ) ;
$newform->freeze() ;
$newform->addElement( 'static', '1)' , babel( "Success") ) ;
$newform->display() ;
$newer_form->display() ;
$newform->process( 'process_manual' , FALSE ) ;
}
When I use this code, both newform and newer_form are frozen, though the
add and remove actions are only applied to newform. So I am pretty sure
that I have two different obejcts not just two references to the same
object.
Why does $newform->freeze() freeze both objects ?
Have a nice day.
--
ZPID - Zentrum für Psychologische Information und Dokumentation
Dipl. Psych. Björn Mittelsdorf Fon: +49(0)651-201-2867
Projekt PsychData Fax: +49(0)651-201-2604
Universität Trier E-Mail: mittelsdorf@zpid.de
54286 Trier http://www.zpid.de/