• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

Sum repeating values on a form

madpato

Member
Hello

I've searched in the forum and the wiki on a way to do this, but it seems its not working for me, here is what i need to achieve:

I have a repeating group with 2 fields one for quantity and other for amount (this one is autofilled with autofil plugin). Now on another non repeating group (in the same form) i have a calc element where i want to show the total value of the sum of the other 2 values, typical cost calculation.
I read this wiki page: http://fabrikar.com/forums/index.php?wiki/form-javascript/#calculating-cost-in-a-repeat-group

Followed the steps but its not clear to me what should be the total element, is it a field? a calc? i have right now a calc but im not getting any result. This is my code i have setup as a onchange event on both quantity and amount elements:

Code:
var i = this.id.match(/_(\d+)$/)[1];
document.id('join___4___kamu_pedidos___total_'+i).value = parseFloat(document.id('join___4___kamu_pedidos_10_repeat___cant_'+i).value) * parseFloat(document.id('join___4___kamu_pedidos_10_repeat___cant_'+i).value);

Regards.
 
that didnt helped much... all it tells its how to show repeated group data, i need how to make the operation, something like:

Code:
$total=(int){element___cant_raw}*{element___value_raw};
return $total;

But it does not work :(
 
I'm hitting my head on wall in this same issue "Coding help needed in calc plugin" (can't post link yet)
 
You can't do calculations for repeat groups in a calc element.

You'll have to do it with Javascript, in a form JS file. There are some examples of that in the forums, try searching for some likely search terms. If you can't find an example, I'll create one for you.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top