Hi all, I tried to multiplicate two form fields in a tablerow just to inform the user and without bothering the server. I'm sure this seems to be a simple javascript problem, but all I got running was the following example:
<tr class="<%= cycle('shade1', 'shade2') %> itemtablerow"> <% fields_for "offer[offer_item_attributes][]", itemtablerow do |f| %> <td><%= f.text_field :pos_number, :size => 2, :index => nil %></td> <td><%= f.collection_select :study_id, Study.find(:all), :id, :index => nil %></td> <td><%= f.text_area :description, :index => nil %></td> <td><%= f.text_field :amount, :class => 'amount', :size => 7, :index => nil %></td> <td><%= f.text_field :price, :class => 'price', :size => 7, :index => nil %></td> <td><%= link_to_function 'product', "alert(parseFloat($(this).up('.itemtablerow').down('.price').getValue()) * parseFloat($(this).up('.itemtablerow').down('.amount').getValue()))"%> </td> </tr> How can I multiplicate the 'price' and the 'amount' fields and show the product "onChange" in the tablerow? Thanks in advance, Marco -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---