0

Form builder behaves unexpectedly when building a form within a table. It closes the form immediately.

Yes, I know that tables are generally bad. But in this case, I'm displaying line items for billing purposes, which is a pretty good use case for tables.

Each row is designed to be its own form that auto-submits on change.

This image explains what is going on

View Source

I'm not sure if this is by design in Rails, or if it's a bug.

I get the whole opinionated software thing, but this behavior is a little extreme.

I promise that there are no bombs in my shoes. The framework should let me do what I want, even if you think it's stupid.

At this point I'm ready to copypasta the raw HTML myself. But, I really shouldn't have to.

What do you guys think (if that's not too gender normative)?

4

2 回答 2

0

在这种情况下,您的工具运行正常,您要求它在 tr.. 下创建一个表单,当您应该将它封装在一个像服务、注释和成本一样的 th 中时..

简而言之,你不能在 tr 下直接有一个“<%= form_for”。将它移到一个 th

于 2013-07-19T18:58:45.727 回答
0

I think the HTML generated by Rails would be the one you expect, it is the browser which parses the HTML which is having trouble with it. You can check that by using View Page Source instead of using Inspect Element to view the HTML generated.

My guess is the HTML from the view source would be something along the lines of:

<form class="submitless" action="/tickets/1294/labors/1090" method="post">
  <td class="service">
    <select>...</select>
    ...
  </td>
</form>

But since this is not valid HTML, the browser might be having a hard time understanding it and is parsing it wrongly.

于 2019-09-05T06:05:40.803 回答