Re: problem with quickform catching all POSTs
| From: | Justin Patrin | Date: | Mon, 02 May 2005 16:46:51 +0000 |
| Subject: | Re: problem with quickform catching all POSTs | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-19043@lists.php.net to get a copy of this message | ||
On 5/2/05, Richard Harding <rick@ricksweb.info> wrote:
> I have a quickform for a login form that I am using with smarty. I also
> have a custom form that appears on a page along with the login
> quickform. What I do on my forms is test the POST to see either what the
> submit button value is or for a specific field to see which form has
> been posted. The quickform form always gets called though and it's
> messing with the page load.
>
> The problem seems to be I have a page redirect if the form validates,
> but it is redirecting every time I submit the other form which it seems
> it shouldn't do because there is no valid login submitted.
>
> Can anyone enlighten me to what is going on and how I might correct it?
> Below is the code to the login form that is a function in a class
> extending quickform. If I comment out the call to this function the
> other form works just fine.
>
> Function creating the form:
> function show_login_form($smarty) {
[snip]
> if( $this->validate() ) {
[snip]
I'm assuming you're extending HTML_QuickForm here.
validate() will return true if *any* form has been submitted on the
page. This is a known issue and there is a feature called track_submit
which "fixes" this by adding a hidden form value that is unique to the
form. Check the constructor for HTML_QuickForm.
--
Justin Patrin