Adding data attributes to the <form> tag based on $field_values passed to gravity_forms()

Anyone know a way to add custom data attributes to the tag e.g.

<form method="post" data-gtm-location="footer">

Using the values in $field_values passed to the GF function call e.g.

gravity_form( 1, false, false, false, array( 'gtm_location' => 'footer' ), false);

The gform_form_tag filter would be perfect, but it only receives the $form object, currently. Same with the gform_get_form_filter filter.

I’m considering parsing the HTML in gform_get_form_filter to get the $field_values saved in <input type="hidden" name="gform_field_values" />. But I’m wondering if there’s a more elegant way to do this.

Anyway, solved it by saving the values in gform_form_args then accessing them in gform_form_tag

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.