How to Add text above every submit button on all forms across site

I am tasked with adding a text disclaimer into all of our many gravity forms across the website directly above the form submit buttons. No checkbox required.

While I know that I can do this with html form element when building forms I was hoping for a more streamlined solution that could be implemented quickly and controlled globally. This disclaimer text is likely to change.

STRUCTURE:

  • Form Fields.
  • Disclaimer text (by submitting this form you agree to…)
  • Form Submit Button

Is this ideal for a filter in my functions.php?

You can make use of the filter gform_submit_button to prepend text to the submit button. You’ll then just need some CSS to set it apart properly.

For example, I’ve used this before:

// Add secure transmission shield to end of forms
add_filter( 'gform_submit_button', function( $button, $form ) {

	return '<span id="secure_shield"><i class="mdi mdi-shield-check" title="All data to and from this page is sent securely.">Secured Data</i><br><a href="/privacy-policy/" class="mdi mdi-file-eye" title="All data entered and submitted via this form is subject to our privacy policy.">Privacy Policy</a></span>' . $button;

}, 10, 2 );

image

1 Like

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