Re: display of submitted values and an empty form on the same page using Quickform
| From: | Justin Patrin | Date: | Thu, 03 Aug 2006 15:19:19 +0000 |
| Subject: | Re: display of submitted values and an empty form on the same page using Quickform | ||
| References: | 1 2 3 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-24821@lists.php.net to get a copy of this message | ||
On 8/3/06, Bjoern Mittelsdorf <mittelsdorf@zpid.de> wrote:
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() ) ) {Try using clone() here.$newer_form = $newform ;
-- Justin Patrin$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 DokumentationDipl. 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/-- PEAR General Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php