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.

    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题