Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
未在Ruby中显示HTML表单元素_Html_Ruby On Rails - Fatal编程技术网

未在Ruby中显示HTML表单元素

未在Ruby中显示HTML表单元素,html,ruby-on-rails,Html,Ruby On Rails,我对如何在rails应用程序的表单视图中显示HTML表单元素感到困惑。我正在使用Thomas Bradley的HTML模板,带有“仅绘制”选项 以下是我的表单视图: <%= form_for(@cms849) do |f| %> <% if @cms849.errors.any? %> <div id="error_explanation"> <h2><%= pluralize(@cms849.errors.c

我对如何在rails应用程序的表单视图中显示HTML表单元素感到困惑。我正在使用Thomas Bradley的HTML模板,带有“仅绘制”选项

以下是我的表单视图:

    <%= form_for(@cms849) do |f| %>
  <% if @cms849.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(@cms849.errors.count, "error") %> prohibited this cms849 from being saved:</h2>
      <ul>
      <% @cms849.errors.full_messages.each do |message| %>
        <li><%= message %></li>
      <% end %>
      </ul>
    </div>
  <% end %>
      </div>
      <form method="post" action":signature" class="sigPad">
  <p class="drawItDesc">Draw your signature</p>
  <ul class="sigNav">
    <li class="drawIt"><a href="#draw-it">Draw It</a></li>
    <li class="clearButton"><a href="#clear">Clear</a></li>
  </ul>
  <div class="sig sigWrapper">
    <canvas class="pad" width="198" height="55"></canvas>
    <input type="hidden" name="output" class="output">
  </div>
  <button type="submit">I accept the terms of this agreement.</button>
</form> 
  <div class="field">
    <%= f.label :signer_name %><br>
    <%= f.text_field :signer_name %>
  </div>
    </div>  
    <div class="actions">
    <%= f.submit %>
  </div>
<% end %>
    <%= render partial: "partials/signatureform" %>
</BODY>
</HTML>

禁止保存此cms849:

画上你的签名

我接受本协议的条款。
为了检查我的工作,我将表单放在它自己的部分中,它可以工作,但不会代替从HTML插入的表单进行渲染


我确信这是一个简单的HTML/Ruby问题,但我自己似乎无法找到它。我也试过用生药,但运气不好

您正试图在的
表单
中嵌套一个
表单
,它将输出自己的
表单
元素。这不是有效的HTML

不知道这是否可行,但您能否将插件所需的
类与
表单_
结合使用

<%= form_for(@cms849, html: { class: 'sigPad' }) do |f| %>
  <% if @cms849.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(@cms849.errors.count, "error") %> prohibited this cms849 from being saved:</h2>
      <ul>
        <% @cms849.errors.full_messages.each do |message| %>
          <li><%= message %></li>
        <% end %>
      </ul>
    </div>
  <% end %>
  <p class="drawItDesc">Draw your signature</p>
  <ul class="sigNav">
    <li class="drawIt"><a href="#draw-it">Draw It</a></li>
    <li class="clearButton"><a href="#clear">Clear</a></li>
  </ul>
  <div class="sig sigWrapper">
    <canvas class="pad" width="198" height="55"></canvas>
    <input type="hidden" name="output" class="output">
  </div>
  <div class="field">
    <%= f.label :signer_name %><br>
    <%= f.text_field :signer_name %>
  </div>
  <div class="actions">
    <%= f.submit 'I accept the terms of this agreement.' %>
  </div>
<% end %>

禁止保存此cms849:

画上你的签名



这很有道理。我应用了您提出的解决方案,它似乎是这样工作的,但它删除了f.label,并且在第一次加载页面时不会加载。在第二页,sigPad表单已加载,但仍缺少f.label。有什么想法吗?