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:
<% fields_for "offer[offer_item_attributes][]", itemtablerow do |f| %>
<%= f.text_field :pos_number,
:size => 2, :index => nil %> |
<%= f.collection_select :study_id, Study.find(:all), :id,
:index => nil %> |
<%= f.text_area :description,
:index => nil %> |
<%= f.text_field :amount, :class => 'amount', :size
=> 7, :index => nil %> |
<%= f.text_field :price, :class => 'price',
:size => 7, :index => nil %> |
<%= link_to_function 'product',
"alert(parseFloat($(this).up('.itemtablerow').down('.price').getValue())
*
parseFloat($(this).up('.itemtablerow').down('.amount').getValue()))"%>
|
How can I multiplicate the ‘price’ and the ‘amount’ fields and show the
product “onChange” in the tablerow?
Thanks in advance,
Marco