dshqd84261 2011-09-19 02:40
浏览 42
已采纳

Zend_Form表格布局

I would like to have a form that gets output into a table. The table I'm wanting would be formatted like the following

<table>
 <thead>
    <tr>
      <th>Name</th>
      <th>ROI</th>
      <th>Hours</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Equipment Name</td>
      <td>Equipment's ROI Element</td>
      <td>Equipment's Hours Element</td>
    </tr>
  </tbody>
</table>

The ROI Element's name will be "roi" plus "equipment['id']". Same for hours, just replace "roi" with "hours". I would need there to be no label for either elements and somehow output "equipment['name']" into the first cell. I can figure that part out, but how do I get elements into a table like that? I've looked at some tutorials, but they don't seem to cover everything I'm trying to do.

The following link is another question I posted about how to add the elements to the form. The accepted answer is now the way the elements are being added.

Zend_Form Array Based Element Setup and Retreival

So my question ends up being, how do I accomplish this form layout?

Edit

I did find this tutorial and was able to follow it. I removed the labels from my elements, as I don't want those in the final product. Now each element is in its own row. How do I set two elements to be in the same row? I also still don't understand how to display the equipment's name inside the same table as the form. Any ideas?

So to clarify, my setup now is:

<table>
  <tbody>
    <tr>
      <td>Equipment's ROI Element</td>
    </tr>
    <tr>
      <td>Equipment's Hours Element</td>
    </tr>
  </tbody>
</table>

As you can tell, there's no head, as I don't know how to do that, and no Equipment Name, and the elements are not grouped into a single row.

The other option is to go this route.

  • 写回答

1条回答 默认 最新

  • duanchi4544 2012-05-16 03:16
    关注

    if you could, i would recommend not using tables. even if you want a table like layout, it's very easily accomplished with css and is much cleaner and very reusable throughout your application.

    with that said, zend forms will add decorators that you will need to remove if they aren't needed. most people simply remove them.

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

报告相同问题?

悬赏问题

  • ¥15 flink cdc无法实时同步mysql数据
  • ¥100 有人会搭建GPT-J-6B框架吗?有偿
  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名