AnsweredAssumed Answered

Multiple onsuccess functions in a form

Question asked by Lucho Soto on Feb 21, 2017
Latest reply on Feb 22, 2017 by Sanford Whiteman

I am trying to have 2 functions execute onsuccess. One is to hide the form and show a thank you message, which we already have working. We want an additional function to send a GA event so GTM can fire additional scripts.


Here is my current form HTML with the thank you message:


<script src="//"></script>

<form id="mktoForm_1516"></form>

<script>MktoForms2.loadForm("//", "XXX-XXX-XXX", 1516);</script>


MktoForms2.whenReady(function (form){

//Add an onSuccess handler

form.onSuccess(function(values, followUpUrl){

   //get the form's jQuery element and hide it


document.getElementById('confirmformcatalog').style.visibility = 'visible';

   //return false to prevent the submission handler from taking the lead to the follow up url.

   return false;






Here is the GA event code I want to insert onsuccess as well. I am not a developer so I'm not sure how to add it to the code above. Can I get some help turning this into working form code? Much appreciated.



        'event': 'gaEvent',

        'eventCategory': 'someclick',

        'eventAction': 'someaction',

        'eventLabel': 'somelabel'