Support » Plugin: Gravity Forms Repeater Add-On » javascript jquery usage to manipulate behaviour of the repeater

  • Resolved thetaxobj

    (@thetaxobj)


    Thanks a lot for this very useful addon. In the readme of the addon, usage of javascript to manipulate how the addon behaves is described – I extract below.

    However the usage doesn’t explain how a wordpress site + gravity forms + gf repeater addon should be adjusted to run the javascript. In which files should the below code appear? Does it need to be in a .js file on the site? Does the code need to be in a wp_enqueue_script() function or must a text/javascript tag be applied to it? Does any adjustment need to be made to how the .js file is called if that is where it is located?

    EXTRACT FROM THE README

    Usage Examples

    Repeat the repeater a number of times depending on the value of a drop down field:

    jQuery(‘#gform_6 #input_6_7’).change(function(){
    var attendees = jQuery(this).val();
    gfRepeater_setRepeater(6, 1, attendees);
    });

    Change the value of a field if the repeater is repeated or un-repeated:

    jQuery(‘#gform_9’).on(‘gform_repeater_after_repeat gform_repeater_after_unrepeat’, function(event, repeaterId, repeatId){
    if (repeaterId == 1) {
    var repeatCount = gfRepeater_repeaters[9][1][‘data’][‘repeatCount’];
    var totalPrice = 27.47 * repeatCount;
    jQuery(‘#gform_9 #input_9_4’).val(‘$’+totalPrice);
    }
    });

    https://wordpress.org/plugins/repeater-add-on-for-gravity-forms/

Viewing 1 replies (of 1 total)
  • Plugin Author Kodie Grantham

    (@kodiegrantham)

    Hey thetaxobj! Basically any of the above! As long as the javascript is loaded on the page somehow, it doesn’t really matter how. You could put it in an inline script tag in your theme, put it in it’s own .js file and enqueue it into your theme, or add it to the end of your theme’s already existing .js file!

Viewing 1 replies (of 1 total)
  • The topic ‘javascript jquery usage to manipulate behaviour of the repeater’ is closed to new replies.