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

        <legend id='xrwke'><style id='xrwke'><dir id='xrwke'><q id='xrwke'></q></dir></style></legend>
      1. <small id='xrwke'></small><noframes id='xrwke'>

        <tfoot id='xrwke'></tfoot>

      2. 向 Zend Forms 添加一些 html

        时间:2023-05-31

        <tfoot id='CDCRi'></tfoot>

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

            <small id='CDCRi'></small><noframes id='CDCRi'>

                  <tbody id='CDCRi'></tbody>
                  本文介绍了向 Zend Forms 添加一些 html的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在寻找一段简单的代码,可以让我将以下 html 添加到我的 zend 表单中:

                  Im looking for a simple bit of code that will let me add the following html into my zend form:

                  <div id="wmd-button-bar" class="wmd-panel"></div>

                  就是这样,它需要在表单中我的方法"元素之上,仅此而已.对于如此简单的操作,我找不到任何不涉及我学习火箭科学(即 Zend 装饰器)的方法.

                  Thats it, it needs to be above my 'method' element in the form but thats it. For such a simple action I cant find any methods that don't involve me learning rocket science (i.e Zend Decorators).

                  推荐答案

                  目前我能想到的唯一方法是在表单中添加一个虚拟元素并移除除具有您指定属性的 'HtmlTag' 之外的所有装饰器在你的问题中.移除装饰器意味着不会渲染实际元素 - 只会渲染 HtmlTag 装饰器.

                  The only way I can think of at the moment is to add a dummy element to the form and remove all decorators except an 'HtmlTag' with the attributes you specified in your question. Removing the decorators means that the actual element will not be rendered - only the HtmlTag decorator will be rendered.

                  所以假设你的表单是 $form:

                  so assuming your form is $form:

                  $form->addElement(
                      'hidden',
                      'dummy',
                      array(
                          'required' => false,
                          'ignore' => true,
                          'autoInsertNotEmptyValidator' => false,
                          'decorators' => array(
                              array(
                                  'HtmlTag', array(
                                      'tag'  => 'div',
                                      'id'   => 'wmd-button-bar',
                                      'class' => 'wmd-panel'
                                  )
                              )
                          )
                      )
                  );
                  $form->dummy->clearValidators();
                  

                  请注意,您要防止对元素进行任何验证.这只是一种方式 - 可能还有其他方式.

                  Note that you want to prevent any validation of the element. This is only one way - there are likely others.

                  输出:

                  <div id="wmd-button-bar" class="wmd-panel"></div>
                  

                  有一个很好的.

                  There is a good article describing decorators.

                  这篇关于向 Zend Forms 添加一些 html的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:(403) 将事件添加到日历时未配置访问权限 下一篇:ZF2 - 将控制器名称放入布局/视图中

                  相关文章

                    <small id='aePWV'></small><noframes id='aePWV'>

                    <legend id='aePWV'><style id='aePWV'><dir id='aePWV'><q id='aePWV'></q></dir></style></legend>
                    1. <tfoot id='aePWV'></tfoot>

                      • <bdo id='aePWV'></bdo><ul id='aePWV'></ul>

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