Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8997231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:51:37+00:00 2026-06-15T23:51:37+00:00

So, I have 3 forms on the same page and same controller action, when

  • 0

So, I have 3 forms on the same page and same controller action, when I click on one of the submit button, it validates all forms instead of the one I clicked.

how can I separate it from validation??

here my code:

public function signUpAction()
{
    $firstName = $this->getRequest()->getParam('firstName');
    $lastName = $this->getRequest()->getParam('lastName');
    $email = $this->getRequest()->getParam('email');
    $emailAdrress = $this->getRequest()->getParam('Email_Address');
    $password = $this->getRequest()->getParam('password');

    $signupForm = new Application_Form_UserSignUp();
    $loginForm = new Application_Form_UserLogin();
    $retreivePasswordForm = new Application_Form_UserRetreivePassword();

    if ($this->getRequest()->isPost('signupForm'))
    {
        /*********** Sign Up Form ***********/
        if ($signupForm->isValid($this->getRequest()->getParams()))
        {
            $user = $this->_helper->model('Users')->createRow($signupForm->getValues());   
            if ($user->save())
            {
                Zend_Session::rememberMe(186400 * 14);
                Zend_Auth::getInstance()->getStorage()->write($user);
                $user->sendSignUpEmail();
                $this->getHelper('redirector')->gotoRoute(array(), 'invite');
                return;
            }
            else 
            {
            }
        }
        else
        {
            // something
        }
    }
    if ($this->getRequest()->isPost('loginForm'))
    {
        /************ Login Form ************/
        if ($loginForm->isValid($this->getRequest()->getParams()))
        {
            $user = $this->_helper->model('Users')->createRow($loginForm->getValues()); 
            $user = $this->_helper->model('Users')->fetchRowByFields(array('email' => $email, 'hash' => $password));

            if($user) 
            {
                Zend_Session::rememberMe(86400 * 14);
                Zend_Auth::getInstance()->getStorage()->write($user);
                $this->getHelper('redirector')->gotoRoute(array(), 'invite');
                return;
            } 
            else {
                // Error message
                $this->view->errorMsg = "<b>password</b> - invalid, please try again! *";
            }               
        }
        else
        {
            // something
        }
    }
    if ($this->getRequest()->isPost('retreivePasswordForm'))
    {
        /****** Retreive Password Form ******/
        if ($retreivePasswordForm->isValid($this->getRequest()->getParams()))
        {
            $user = $this->_helper->model('Users')->createRow($retreivePasswordForm->getValues()); 
            $user = $this->_helper->model('Users')->fetchRowByFields(array('email' => $emailAdrress));
            if($user)
            {
                Zend_Auth::getInstance()->getStorage()->write($user);
                $user->sendRetreiveEmail();

                $_SESSION['email'] = $emailAdrress;

                $redirector = $this->_helper->getHelper('redirector');
                $redirector->setCode(301)->setUseAbsoluteUri();
                $newPath = 'http://refer.lavasoft.com/#retreive_sent';
                $redirector->gotoUrl($newPath);

                //$this->view->assign('sendEmail', $emailAddress);
            }
            else
            {
            }
        }
        else
        {
            // something
        }

    }

    $this->view->retreivePasswordForm = $retreivePasswordForm;
    $this->view->loginForm = $loginForm;
    $this->view->signupForm = $signupForm;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T23:51:38+00:00Added an answer on June 15, 2026 at 11:51 pm

    This is not how it works in ZF. You cannot pass the form name to isPost() unless you override isPost() in your code.

    What you could do is Define all your fields like:

    loginForm[name]
    loginForm[password]
    

    and

    signupForm[name]
    

    etc
    then just check for isset($_POST['loginFom'])

    This should work fine.

    Or use a hidden field named formName and check in your code what’s its value is.

    You can also use a different action for each form and in the end redirect to the signUpAction wich would yeld the same result without the hassle.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can two forms share the same inputs? I have two forms, one for
I have 2 forms on the same page. One is a form in a
I have 3 forms at the same page and each has a different form
I have multiple ajax forms on page that cointain same elemets, I have jquery
I have a website with several forms that all pass the same set of
I have the folowing gsp page: <g:form controller=?? action=??> <h1>Search</h1> <g:submitButton name=search value=Search/> <div
I have a page that contains 3 forms, each one with a Zend_Form_Element_Hash for
Stupid question... I have two forms with two different functions on one page, my
I have a form that auto submits and updates the same page. I have
I have 2 basic forms: sign in and sign up, both on the same

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.