Here is an example code that I wrote to do just that. It would only work with the latest development version though and you’ll probably have to change the field IDs and do a little tweaking:
jQuery('#gform_37').on('gform_repeater_init_done gform_repeater_after_repeat gform_repeater_after_unrepeat', function(event, repeaterId, repeatId){
if (repeaterId == 1) {
var totalMiles = 0;
var milesFields = gfRepeater_select(37, 1, null, 3, 1);
jQuery.each(milesFields, function(){
if (this.val()) { totalMiles += Number(this.val()); }
});
jquery('#input_37_11').val(totalMiles);
}
});
Find out how to install the latest development version here: https://github.com/kodie/gravityforms-repeater#development
Thank you very much Kodie!
I will try that and get back to you 🙂
I’m trying to use this to calculate total ticket price for multiple attendees. I have installed the latest dev version and my form is at http://www.rochesterdowntown.com/luncheon-payment (below the paypal stuff) . I’m using the following code but am not sure what is incorrect and where I should be placing this. Does it go in gf-repeater.js? Thank you
jQuery('#gform_1').on('gform_repeater_init_done gform_repeater_after_repeat gform_repeater_after_unrepeat', function(event, repeaterId, repeatId){
if (repeaterId == 1) {
var totalPrice = 0;
var milesFields = gfRepeater_select(41, 1, 2, null, null, null, null);
jQuery.each(milesFields, function(){
if (this.val()) { totalPrice += Number(this.val()); }
});
jquery('#input_1_5').val(totalPrice);
}
});
nvm. I found a different solution
Hi lowfry, always interesting to learn from your different solution 🙂
Is there a solution for this issue of Totaling repeater number fields in a number field outside the Repeater, since it doesn’t appear to work?
Thank You
I’m trying to get this to work on a simple form, and I can’t get the jQuery(‘#form_X’).on(…) to trigger correctly.
Hi Kodie,
Will you be updating the add-on to include the javascript snippet that allows us to total up repeating number fields? That would be a HUGE help.
Thanks!