Re: QuickForm Clear posted fields

From: Date: Tue, 07 Feb 2006 15:11:35 +0000
Subject: Re: QuickForm Clear posted fields
References: 1 2 3 4 5 6 7 8  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-22839@lists.php.net to get a copy of this message
Hi, Damien Cros wrote:
Isn't there a way to avoid the redirect? I mean, it's easy to do it without quickform. Why would it be impossible to do it with quickform?
You don't want to "avoid" the redirect. If you "avoid" it, the form will be re-submitted on page reload, and you'll ask questions here on how to avoid *that*.
I'm sorry, I don't understand. What you're saying is that something like this: $myElement = $form->addElement(.... $form->addRule(... if($form->validate()) {
    // insert
    // clear $_request or whatever
    $form->clearValues();
} $form->display() wouldn't work?
No, I'm saying that it will work, but you won't like the result. You may clean the displayed form fields' values without redirect, but the submitted values will stay. And they will be submitted again if the user hits "Reload".

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