Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gravity forms fire js event on successfull form submission

Is it in gravity forms anyhow possible to fire an javascript event on an successful ajax form transmittion?

Adding html javascript into the displayed response does not seem to work eg:

<script>console.log("successful-form-transmition");</script>
like image 261
Manuel Avatar asked Jul 22 '15 14:07

Manuel


People also ask

How do you keep gravity forms displayed after submission?

You can use a shortcode in your text confirmation. Just use the same shortcode you used in the post to embed the form in the first place, and the form will be inserted into your text confirmation.

How do you track gravity form?

Go to Forms and open the one you wish to track. Click Confirmations. Usually, the Confirmation type is “Text” and what you'll need to do is to add a small JavaScript code there. It will create a Data Layer event “formSubmission” which we'll use later as a trigger.

How do you use gravity forms in Javascript?

Download, install, and activate the plugin. Navigate to your Form Settings to find the new Custom Javascript field. Once the plugin is installed and activated, you'll find the Custom Javascript field in your Form Settings. It includes a robust editor that will automatically highlight syntax to make it easy to read.


1 Answers

There's an event fired upon successful Gravity Forms submission: gform_confirmation_loaded. You can use it with jQuery like so:

$(document).on("gform_confirmation_loaded", function (e, form_id) {
  // code to run upon successful form submission
});

See documentation

like image 58
Abraar Arique Diganto Avatar answered Sep 17 '22 17:09

Abraar Arique Diganto