You are viewing limited content. For full access, please sign in.

Question

Question

several row calculations in Forms

asked on October 11, 2015 Show version history

I have created a form where Products A B & C are added together to total " Total Plants" I then want the "Total Plants Field to multiply the "Unit Price" to give me the " Total Price".

So A + B + C = Total Plants

Unit Price * Total Plants = Total Price

 

I cant seem to be able get the Total Price working

As you can see, there can be multiple rows as well, with a total for each row.

 


       

 

  

code.jpg
code.jpg (67.44 KB)
0 0

Answer

SELECTED ANSWER
replied on October 12, 2015 Show version history

Hi Tim,

You should just be able to use a similar technique to what you've already done. You'd need to use something like this at the bottom of your code block (but still within the $(document).ready function!)

var subtotal = $(this).find(".subtotal input").val();
var unitPrice = $(this).find(".rate input").val();
var totalPrice = subtotal * unitPrice;
$(this).find(".total input").val(totalPrice);

Hope this helps!

Dan

2 0

Replies

replied on October 12, 2015

That works perfect, thank you !!!

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.