English 中文(简体)
Jquery Raty Matsuding on Railways form
原标题:Jquery Raty star-rating on Rails form

在用户点击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">&nbsp;
  <img src="/assets/star-on.png" alt="2" title="poor">&nbsp;
  <img src="/assets/star-on.png" alt="3" title="regular">&nbsp;
  <img src="/assets/star-on.png" alt="4" title="good">&nbsp;
  <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>
最佳回答

页: 1 展望:

<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 %>

<代码>form在表格内开始,但在表外结束。 这将使超文本不包含所有<代码>input和某些通用的杂质,因为浏览器可以显示你的含义。

顺便说一句,使用哈马法会绕过这类问题,但他本人会:

问题回答

暂无回答




相关问题
rails collection_select vs. select

collection_select and select Rails helpers: Which one should I use? I can t see a difference in both ways. Both helpers take a collection and generates options tags inside a select tag. Is there a ...

SSL slowness in EC2

We ve deployed our rails app to EC2. In our setup, we have two proxies on small instances behind round-robin DNS. These run nginx load balancers for a dynamically growing and shrinking farm of web ...

Auth-code with A-Za-z0-9 to use in an URL parameter

As part of a web application I need an auth-code to pass as a URL parameter. I am currently using (in Rails) : Digest::SHA1.hexdigest((object_id + rand(255)).to_s) Which provides long strings like : ...

RubyCAS-Client question: Rails

I ve installed RubyCAS-Client version 2.1.0 as a plugin within a rails app. It s working, but I d like to remove the ?ticket= in the url. Is this possible?

activerecord has_many :through find with one sql call

I have a these 3 models: class User < ActiveRecord::Base has_many :permissions, :dependent => :destroy has_many :roles, :through => :permissions end class Permission < ActiveRecord::...

Ordering a hash to xml: Rails

I m building an xml document from a hash. The xml attributes need to be in order. How can this be accomplished? hash.to_xml

Text Editor for Ruby-on-Rails

guys which text editor is good for Rubyonrails? i m using Windows and i was using E-Texteditor but its not free n its expired now can anyone plese tell me any free texteditor? n which one is best an ...

How to get SQL queries for each user where env is production

I’m developing an application dedicated to generate statistical reports, I would like that user after saving their stat report they save sql queries too. To do that I wrote the following module: ...

热门标签