<bdo id='hEZDG'></bdo><ul id='hEZDG'></ul>
    1. <tfoot id='hEZDG'></tfoot>

      1. <small id='hEZDG'></small><noframes id='hEZDG'>

        <i id='hEZDG'><tr id='hEZDG'><dt id='hEZDG'><q id='hEZDG'><span id='hEZDG'><b id='hEZDG'><form id='hEZDG'><ins id='hEZDG'></ins><ul id='hEZDG'></ul><sub id='hEZDG'></sub></form><legend id='hEZDG'></legend><bdo id='hEZDG'><pre id='hEZDG'><center id='hEZDG'></center></pre></bdo></b><th id='hEZDG'></th></span></q></dt></tr></i><div id='hEZDG'><tfoot id='hEZDG'></tfoot><dl id='hEZDG'><fieldset id='hEZDG'></fieldset></dl></div>
      2. <legend id='hEZDG'><style id='hEZDG'><dir id='hEZDG'><q id='hEZDG'></q></dir></style></legend>

        Zend Framework - 在选择框下拉列表中设置“选定&q

        时间:2023-10-03

      3. <i id='3C4zR'><tr id='3C4zR'><dt id='3C4zR'><q id='3C4zR'><span id='3C4zR'><b id='3C4zR'><form id='3C4zR'><ins id='3C4zR'></ins><ul id='3C4zR'></ul><sub id='3C4zR'></sub></form><legend id='3C4zR'></legend><bdo id='3C4zR'><pre id='3C4zR'><center id='3C4zR'></center></pre></bdo></b><th id='3C4zR'></th></span></q></dt></tr></i><div id='3C4zR'><tfoot id='3C4zR'></tfoot><dl id='3C4zR'><fieldset id='3C4zR'></fieldset></dl></div>

        <small id='3C4zR'></small><noframes id='3C4zR'>

            <tbody id='3C4zR'></tbody>

                <legend id='3C4zR'><style id='3C4zR'><dir id='3C4zR'><q id='3C4zR'></q></dir></style></legend>
                  <bdo id='3C4zR'></bdo><ul id='3C4zR'></ul>
                  <tfoot id='3C4zR'></tfoot>
                  本文介绍了Zend Framework - 在选择框下拉列表中设置“选定"值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在向 Zend_Form 实例添加一个 select 元素,如下所示:

                  I am adding a select element to a Zend_Form instance as follows:

                    $user = $form->createElement('select','user')->setLabel('User: ')->setRequired(true);
                    foreach($users as $u)
                          {
                              if($selected == $u->id)
                              {
                                  $user->addMultiOption($u->id,$u->firstname.' '.$u->lastname);
                                  //*** some way of setting a selected option? selected="selected"
                  
                              }
                              else
                                  $user->addMultiOption($u->id,$u->firstname.' '.$u->lastname);
                          }
                  

                  我一直在搜索文档,但找不到将选择元素的选项预先设置为已选择"的简单方法.

                  I have been searching the docs but cannot find a simple way of pre-setting an option of the select element to 'selected'.

                  推荐答案

                  我刚刚想出了如何去做.

                  I've just worked out how to do it.

                  必须使用元素的 setValue() 方法:

                  You have to use the setValue() method of the element:

                  $user = $form->createElement('select','user')->setLabel('User: ')->setRequired(true);
                      foreach($users as $u)
                          $user->addMultiOption($u->id,$u->firstname.' '.$u->lastname);
                  
                  $user->setValue($selected); //$selected is the 'value' of the <option> that you want to apply selected="selected" to.
                  

                  这篇关于Zend Framework - 在选择框下拉列表中设置“选定"值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何在路由 INI 文件中为 Zend Framework 中的子域编 下一篇:如何将 PHP 数组编码为 JSON 数组,而不是对象?

                  相关文章

                  最新文章

                    <legend id='2SECY'><style id='2SECY'><dir id='2SECY'><q id='2SECY'></q></dir></style></legend>

                    <i id='2SECY'><tr id='2SECY'><dt id='2SECY'><q id='2SECY'><span id='2SECY'><b id='2SECY'><form id='2SECY'><ins id='2SECY'></ins><ul id='2SECY'></ul><sub id='2SECY'></sub></form><legend id='2SECY'></legend><bdo id='2SECY'><pre id='2SECY'><center id='2SECY'></center></pre></bdo></b><th id='2SECY'></th></span></q></dt></tr></i><div id='2SECY'><tfoot id='2SECY'></tfoot><dl id='2SECY'><fieldset id='2SECY'></fieldset></dl></div>
                    • <bdo id='2SECY'></bdo><ul id='2SECY'></ul>

                  1. <small id='2SECY'></small><noframes id='2SECY'>

                  2. <tfoot id='2SECY'></tfoot>