簡體   English   中英

從zend中的多選項表單獲取價值

[英]Get value from multioptions form in zend

假設我有以下表單子表單:

$form->addElement('select','foo',
array(
    'label'        => 'ComboBox (select)',
    'value'        => 'blue',
    'multiOptions' => array(
        'red'    => 'Rouge',
        'blue'   => 'Bleu',
        'white'  => 'Blanc',
    ),
    )
);

我如何從multiOptions獲得價值? 我設法使用

$subForm = $form->getElement("foo");

您可以使用getMultiOptions()getMultiOption()方法,如下所示。

$form->getElement("foo")->getMultiOptions(); //Get all options

$form->getElement("foo")->getMultiOption('option'); //Get one option.

您可以在下面的ZF文檔鏈接中找到更多方法。

ZF多選

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM