Sunday, July 24, 2011

[Rails] counting a check_box selections?

Hello to everybody!

I have the following code in new.html.erb allowing a user to
select more questions (item) for creating a questionnaire:

...
<% for item in @itemss %>
<%= check_box_tag "questionnaire[item_ids][]", item.id,
@questionnaire.items.include?(item) %>
<a> <%= item.kind %> <span> <%= item.question %> </span> </a>
- "<%= item.denomination %>" - p.ti <%= item.score %> <br/>
<% end %>
...

I would like to show, while the user is making his choices, the
calculation of:
- the number of selected items
- the sum of the scores (each item has its own score)

any suggestions?

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate