title: Jquery Raty star-rating on Rails form
body: <p>The following line is generated by jquery in the DOM when a user clicks to make a 5 star rating:</p>
  
  <pre><code>&lt;input type="hidden" name="review[answer01]" id="review_answer01" value="5"&gt;
  </code></pre>
  
  <p>Somehow my controller is not picking up this value for params[:review][:answer01]</p>
  
  <p>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. </p>
  
  <p>Everything worked fine with a simple radio button select.</p>
  
  <p>BTW I manually added the same line of code to my form and it worked. I put </p>
  
  <pre><code>&lt;%= f.hidden_field :answer01, :value =&gt; 5 %&gt;
  </code></pre>
  
  <p>which produced html:</p>
  
  <pre><code>&lt;input id="review_answer01" name="review[answer01]" type="hidden" value="5"&gt;
  </code></pre>
  
  <p>I just don't get it...</p>
  
  <p>EDIT:</p>
  
  <p>Here is the js source Here is the js: <a href="https://github.com/wbotelhos/raty/blob/master/js/jquery.raty.js" rel="nofollow">https://github.com/wbotelhos/raty/blob/master/js/jquery.raty.js</a></p>
  
  <p>The input tags are generated by line 62, which I modded slightly to give an ID ( I wasn't sure if that was the issue ). </p>
  
  <p>My line 62: <code>self.score = $('&lt;input /&gt;', { type: 'hidden', name: self.opt.scoreName, id: self.opt.scoreId}).appendTo(self);</code></p>
  
  <p>I also added <code>scoreID : 'blank'</code> to <code>$.fn.raty.defaults {}</code> to provide an option to set ID.</p>
  
  <p>Now, inside my view I have:</p>
  
  <pre><code>&lt;table class='table'&gt;
    &lt;tbody&gt;
  
    &lt;%= simple_form_for @review, :html =&gt; { :multipart =&gt; true } do |f| %&gt;
  
      &lt;td style='width:115px; padding-top:10px;'&gt;&lt;div id="s1"&gt;&lt;/td&gt;
      &lt;td&gt;&lt;h3 style = 'padding-bottom:3px;'&gt;&lt;%= @questions[0] %&gt;&lt;/h3&gt;&lt;/td&gt;
  
      [...] (repeated for other questions)
  
    &lt;/tbody&gt;
  &lt;/table&gt;
  
    &lt;div style='margin-left:80px; margin-top:20px; margin-bottom:200px;' id='subbut'&gt;
      &lt;%= f.button :submit, "Submit Review", :class=&gt;'btn btn-large' %&gt;
    &lt;/div&gt;
    &lt;% end %&gt;
  
  &lt;script&gt;
  $('#s1').raty({
      scoreName : 'review[answer01]',
      scoreId : 'review_answer01'
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>What I see in firebug DOM analysis with 5/5 star selected:</p>
  
  <pre><code>&lt;td style="width:115px; padding-top:10px;"&gt;
  &lt;div id="s1" style="cursor: pointer; width: 100px; "&gt;
    &lt;img src="/assets/star-on.png" alt="1" title="bad"&gt;&amp;nbsp;
    &lt;img src="/assets/star-on.png" alt="2" title="poor"&gt;&amp;nbsp;
    &lt;img src="/assets/star-on.png" alt="3" title="regular"&gt;&amp;nbsp;
    &lt;img src="/assets/star-on.png" alt="4" title="good"&gt;&amp;nbsp;
    &lt;img src="/assets/star-on.png" alt="5" title="gorgeous"&gt;
    &lt;input type="hidden" name="review[answer01]" id="review_answer01" value="5"&gt;
  &lt;/div&gt;
  &lt;/td&gt;
  </code></pre>
  
  <p>FORM TAG:</p>
  
  <pre><code>&lt;form accept-charset="UTF-8" action="/reviews" class="simple_form new_review" enctype="multipart/form-data" id="new_review" method="post" novalidate="novalidate"&gt;&lt;/form&gt;
  </code></pre>