nilesh suryavanshi
nilesh suryavanshi

Reputation: 408

how to Assign name to drop down options

Using Phalcon framework, I have a Form class file where I declare select and render in .volt file:

$soc_bulding =  new Select("soc_building_id", $options['soc_bulding'], 
    array('using' => array('soc_building_id', 'soc_building_name'), 
          "class" => "mandatory-field") );
$soc_bulding->setLabel("Buiding name" . REQ_FIELD);
$this->add($soc_bulding);

in the above code, 'using' => array('soc_building_id', 'soc_building_name') reflect soc_building_id as option value and soc_building_name actual text in drop down option, but I want one more property name in that same option box, already tried to pass 3 parameter to that array but it's not working.

Upvotes: 3

Views: 131

Answers (1)

Zahid Khowaja
Zahid Khowaja

Reputation: 66

Please use the code below and replace yours

echo $this->tag->select(array("users",
        Users::find(),
        "useEmpty"  =>  true,
        "emptyText" =>  "Please select",
        "using" => array("id", "name"),
     ));

Upvotes: 2

Related Questions