dongxianchu3541 2009-08-18 06:01
浏览 31
已采纳

是否可以完全控制zend_form布局?

I've been working with Zend Framework for a couple weeks so this might be a complete noobie question but I'm wondering if there's a way to customize the layout of forms in an explicit way using Zend_Form. I've looked all over the place but every example of Zen-Form I've found use the echo example.

For example, when I work with Smarty and HTML_QuickForm I have the option of placing each form element onto the page where ever I want.

{if $Form.errors}<span class="errorMessage">Error!</span>{/if}
{if $Form.Email.error}Fill out field{if}
{$Form.Email.html}
{$Form.Submit.html}

But with Zend Framework it looks like I have to decorate the form elements in the actual php code and echo the completed form:

echo $this->form;

If it's not possible are there any php frameworks that do allow this level of control?

  • 写回答

1条回答 默认 最新

  • dongshang1768 2009-08-18 08:42
    关注

    you can render each element seperatly.

    Just use

    <?php echo $this->form->age ?>
    <?php echo $this->form->lastname ?>
    

    in your view-script, to render only some "elements". To render Form-Controlls use :

    <form action="<?php echo $this->escape($this->form->getAction() ?>"
          method="<?php echo $this->escape($this->form->getMethod() ?>">
    

    You can find more examples here :

    Decorate Zend Forms on DevZone

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)