在用户点击5级粗略评级时,电离层电离层产生以下线:
<input type="hidden" name="review[answer01]" id="review_answer01" value="5">
我的控制者没有为寄生于这一价值[:审查][:swer01]。
It seems to me that when I click the submit button the hidden value isn t being sent at all. Is the form not aware of the hidden field because it s not present at the start? How do I fix this.
一切都用简单的无线电纽子进行罚款。
BTW 我手工地将同一条码加到我的表格中,并发挥了作用。 我
<%= f.hidden_field :answer01, :value => 5 %>
编写:
<input id="review_answer01" name="review[answer01]" type="hidden" value="5">
......
EDIT:
这里是垃圾来源 https://github.com/wbotelhos/raty/blob/master/js/jquery.raty.js”rel=“nofollow”
输入标数是第62行产生的,我很奇怪,可以提供识别资料(如果是问题,我肯定会这样做)。
我的行文62: Self.score =$( <input />>,{类型:隐藏的,名称:自律的,分Name, id: Self.opt.scoreId}).append To( Self);
我还添加了<代码>核心ID :空白至$.fn.raty.defaults{}
,以提供设定ID的选择。
现在,我认为我已经:
<table class= table >
<tbody>
<%= simple_form_for @review, :html => { :multipart => true } do |f| %>
<td style= width:115px; padding-top:10px; ><div id="s1"></td>
<td><h3 style = padding-bottom:3px; ><%= @questions[0] %></h3></td>
[...] (repeated for other questions)
</tbody>
</table>
<div style= margin-left:80px; margin-top:20px; margin-bottom:200px; id= subbut >
<%= f.button :submit, "Submit Review", :class=> btn btn-large %>
</div>
<% end %>
<script>
$( #s1 ).raty({
scoreName : review[answer01] ,
scoreId : review_answer01
});
</script>
我在“DOM”的火力分析中看到,5/5星挑选了:
<td style="width:115px; padding-top:10px;">
<div id="s1" style="cursor: pointer; width: 100px; ">
<img src="/assets/star-on.png" alt="1" title="bad">
<img src="/assets/star-on.png" alt="2" title="poor">
<img src="/assets/star-on.png" alt="3" title="regular">
<img src="/assets/star-on.png" alt="4" title="good">
<img src="/assets/star-on.png" alt="5" title="gorgeous">
<input type="hidden" name="review[answer01]" id="review_answer01" value="5">
</div>
</td>
FORM TAG:
<form accept-charset="UTF-8" action="/reviews" class="simple_form new_review" enctype="multipart/form-data" id="new_review" method="post" novalidate="novalidate"></form>