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

  • Home
  • SEARCH
  • 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 7787765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:46:28+00:00 2026-06-01T20:46:28+00:00

I try to do it this way: public function init() { /* Form Elements

  • 0

I try to do it this way:

public function init()
{
    /* Form Elements & Other Definitions Here ... */

    $sets_table = new Optionals_Model_DbTable_Sets();

    $set = new Zend_Form_Element_Select('set');
    $set ->setLabel('Alegeti setul de optionale:');

    foreach ($sets_table->getSets() as $value) {
        echo $value->cod_set_optional;
        $set->addMultiOption($value->cod_set_optional);
    }

    $submit = new Zend_Form_Element_Submit('Continua');

    $this->addElements ( array (
            $set,
            $submit
    ) );
}

where getSets() from the DbTable looks like this:

public function getSets()
{
    $select = $this->select();
    $rows = $this->fetchAll($select);
    if (!$rows) {
        throw new Exception("Could not find!");
    }
    return $rows;
}

I’ve seen this kind of doing it HERE, but it doesn’t work. The echo works fine, but the combobox is not populated. Is there something wrong in my code or what?

Thank you!
Sorin

  • 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-01T20:46:29+00:00Added an answer on June 1, 2026 at 8:46 pm

    addMultiOption($option, $value) requires two parameters and you are giving it only a value.

    you should do this :

     foreach ($sets_table->getSets() as $set) {
            $set->addMultiOption($set->id , $set->value);
        }
    

    make sure your getSets returns both an id and a value from your table.

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

Sidebar

Related Questions

Will declaring the function in this way have any implications on the performance? public
Okay I'll try describe this the best way I can. I have a chat
After failing to achieve this with link_to remote, I decided to try jQuery way.
I have a action script from a decompile flash like this public function getResourceAsByteArray(resID:int):flash.utils.ByteArray
Lets say that i have this block of text public function __construct() { parent::__construct();
I am querying an xml file with php like this : public function trackOrderAction()
I try to use This Way to fire a custom validator in client side
I try to do list of procedures this way: type TProc = procedure of
please try this link for getting my code. its working in all browsers not
I try this command to upload a file (standard.xml) into table book the file

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.