Re: QuickForm reload for editing

From: Date: Fri, 07 Jan 2005 07:25:14 +0000
Subject: Re: QuickForm reload for editing
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-16772@lists.php.net to get a copy of this message
On Thu, 06 Jan 2005 22:09:48 -0800, Ed Greenberg <edg@greenberg.org> wrote: > [Sorry if this is a duplicate... I'm not sure the original got out.] > I really appreciate the help I've gotten here, especially from Justin. > > So I have my form: > ------------ > $form = new HTML_QuickForm('frmPost', 'post'); > $form->addElement(...); > $form->addElement(...); > $form->addElement(...); > > $form->addRule(...); > $form->addRule(...); > $form->addRule(...); > > if ($form->validate()) { > > // this is where I'm going to process the form on success, > // and it's the focus of my question below > > } > $renderer =& new HTML_QuickForm_Renderer_ArraySmarty($t); > $form->accept($renderer); > $t->assign('form_data', $renderer->toArray()); > $t->display($current_language.'/post.html'); > > ------------------ > > While processing a correctly filled out form, I'd like to echo back the > submitted info as a frozen form, and then allow the user to select options: > > 1. actually submit the data for processing > 2. go back to the form, with all the data available for editing. > 3. abandon the form > > 1 and 3 are easy. What can I put in there to send myself back around > again. It feels like I need to simulate failing validation. > Of course not. ;-) if ($form->validate()) { if ($_REQUEST['save'] == 'yes') { //process here } else { $form->addElement('submit', 'save', 'yes'); $form->freeze(); echo 'Are you sure?<br/>'.$form->toHtml(); } } > Help? > > </edg> > > -- > PEAR General Mailing List (http://pear.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > !DSPAM:41de385d281616686512980! > > -- Justin Patrin

« previous php.pear.general (#16772) next »