Hello
I am trying to make a typical price calculator based on num. of items * price on a repeating group but it seems that it does not work. I am making my calculation on a calc element but reading the wiki here: http://fabrikar.com/forums/index.php?wiki/form-javascript/#calculating-cost-in-a-repeat-group
Says i need a js file to achieve this, so this is what i have:
fields:
cant (sets amount of products)
valor (price of the product)
total (grand total)
my 6.js file:
My element's JS function (on change event)
Any help on how to achieve this is appreciated. Thanks
I am trying to make a typical price calculator based on num. of items * price on a repeating group but it seems that it does not work. I am making my calculation on a calc element but reading the wiki here: http://fabrikar.com/forums/index.php?wiki/form-javascript/#calculating-cost-in-a-repeat-group
Says i need a js file to achieve this, so this is what i have:
fields:
cant (sets amount of products)
valor (price of the product)
total (grand total)
my 6.js file:
Code:
function sum() {
var q = form_6.formElements.get('table1_10_repeat___pedido').getValue();
var p = form_6.formElements.get('table1_10_repeat___cant').getValue();
var t = parseFloat(q) * parseFloat(p);
form_X.formElements.get('table1___total').update(t);
}
My element's JS function (on change event)
Code:
var i = this.id.match(/_(\d+)$/)[1];
document.id('join___4___table1___total_'+i).value = parseFloat(document.id('join___4___table1_10_repeat___cant_'+i).value) * parseFloat(document.id('join___4___table1_10_repeat___cant_'+i).value);
Any help on how to achieve this is appreciated. Thanks