Re: QuickForm using freeze() as a preview
| From: | Alexey Borzov | Date: | Fri, 27 Oct 2006 08:29:27 +0000 |
| Subject: | Re: QuickForm using freeze() as a preview | ||
| References: | 1 2 3 4 5 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-25656@lists.php.net to get a copy of this message | ||
Hi,
Charles Kline wrote:
My one other related question is this. My form has a group of buttons "submit" and "reset". I would like to hide the reset button after the form has been submitted. Is there a way to removeElement() on the button in the process function? Or is this better done with a conditional in the section of code where I declare the group of buttons?I am not sure why are you mentioning process function, since you will most certainly *not* output the form after you call that. I'd suggest the following script structure: // build form here if ($form->validate()) { if (/* second submit token present? */) {
// process form
// do a redirect
} else {
// add second submit token
// remove unnecessary buttons
// freeze form
}
}
// output form here
Of course you can also add necessary buttons / group right before you output the form, since they don't affect validation.
Charles Kline wrote:$hidden =& $form->addElement('hidden', 'is_this_actually_a_second_submit'); $hidden->setValue('this is exactly the case!');Charles Kline wrote:This much I understand. Let me clarify... once the form has been submitted and frozen() if the submit button is then clicked again, how do I check for this so I can process the data and not freeze() on the second submit. Is this more clear?If I am using freeze() in my form to give the user a preview of the submitted data before processing, how do I then POST the frozen form for processing? What is the method to use when doing this?You usually post the form by clicking a submit button.