Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7924655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T17:51:42+00:00 2026-06-03T17:51:42+00:00

The following line is generated by jquery in the DOM when a user clicks

  • 0

The following line is generated by jquery in the DOM when a user clicks to make a 5 star rating:

<input type="hidden" name="review[answer01]" id="review_answer01" value="5">

Somehow my controller is not picking up this value for params[:review][:answer01]

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.

Everything worked fine with a simple radio button select.

BTW I manually added the same line of code to my form and it worked. I put

<%= f.hidden_field :answer01, :value => 5 %>

which produced html:

<input id="review_answer01" name="review[answer01]" type="hidden" value="5">

I just don’t get it…

EDIT:

Here is the js source Here is the js: https://github.com/wbotelhos/raty/blob/master/js/jquery.raty.js

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 ).

My line 62: self.score = $('<input />', { type: 'hidden', name: self.opt.scoreName, id: self.opt.scoreId}).appendTo(self);

I also added scoreID : 'blank' to $.fn.raty.defaults {} to provide an option to set ID.

Now, inside my view I have:

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

What I see in firebug DOM analysis with 5/5 star selected:

<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 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T17:51:43+00:00Added an answer on June 3, 2026 at 5:51 pm

    Your HTML structure isn’t right… Look:

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

    The form starts inside the table, but ends outside. this will cause the HTML to be parsed as not including all the inputs and some general weirdness because the browser can’t figure out what you meant.

    Incidentally, using HAML would circumvent that kind of problems, but to each his own 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have the following jquery code: $(document).ready(function() { $('.restrictiveOptions input[type!=checkbox], .restrictiveOptions select').change(function() { //
The following jQuery works fine in Firefox for me, but failed in IE6: $(<map></map>).attr(name,somevar).appendTo(#someElement);
I use the following line of code to have Adobe Reader print my generated
Sometimes, due to faulty data collected, a line generated by the following method ends
If a auto generated django.po file contains the following line in its header Plural-Forms:
I have an HTML document with the following form: <form> <input type=text id=price> <input
The following line of code generates the compile time error (PE19) There is no
I have following line of code to generate local notification after every 1 minute
The following line in my C program should provided All/Group/Owner read and write permissions
The following line printed output as 4 whereas I was expecting 0. printk(KERN_INFO size

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.