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 9000797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:21:18+00:00 2026-06-16T00:21:18+00:00

I know this question is already answered here . But this doesnt work for

  • 0

I know this question is already answered here. But this doesnt work for me.
The Form is generated by using the PluginLoader:

$formClass = Zend_Registry::get('formloader')->load('Payment');
$form = new $formClass(array('someval' => $my_arr));

Payment.php:

class Form_Payment extends Zend_Form
{

   protected $_someval = array();

   public function init()
   {
      $this->setAction('payment/save');
      //....
      $this->addElement('multiCheckbox', 'store_id', array('label' => 'Someval:', 'required' => true, 'multiOptions' => $this->getSomeval()))
   }

   public function setSomeval($someval) {
      $this->_someval = $someval;
   }

   public function getSomeval() {
      return $this->_someval;
   }
}

As I can see the load method only returns the class name, so new $formClass(); is equal new Form_Payment() but why this isn’t accept params?

  • 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-16T00:21:18+00:00Added an answer on June 16, 2026 at 12:21 am

    Ok I found a way by myself. I was looking for a way to inject some params while my Zend_Form was initialised. It seems the only way for this is to pass the params to the constructor – which is executed before the init method.

    class Form_Payment extends Zend_Form
    {
    
       private $_someval;
    
       public function __construct(array $params = array())
       {
           $this->_someval = $params['someval'];
           parent::__construct();
       }
    
       public function init()
       {
          $this->setAction('payment/save');
          //....
          $this->addElement('multiCheckbox', 'store_id', 
             array('label' => 'Someval:', 
                   'required' => true, 
                   'multiOptions' => $this->_someval // passed params now available
             )) 
       }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There's already a question on this here. But i want to know if its
I know this question has already been asked and answered, but it didn't help
I know this question was probably already answered but I just don't know what
This question is already asked but was still not answered. ( here ) I
I know this question has already been answered but despite my efforts I can't
I don't know if this question is already answered on stackoverflow. But I simply
I know this question was already posted in StackOverflow but I either didnt understand
I know this question might have already been discussed a thousands of times but
I know this sounds similar to many questions already asked, but those were answered
I know this is a basic question that has already been answered thousand times,

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.