Execute code after form is posted (formhandler.js)


#1

Hey, everyone! Especially, @Norm :grin:

I have a simple question. I need to execute js code (mainly to send tracking information to analytics firm akin to Google) after form is successfully send. The code itself is provided by advertiser, i just need to put in the right place.

The problem is that this code is only tracking ONE form. But as we know, in blocs we can have multuple forms on a website.

So, there are two forms on my website i need to track through this and this means i need to put two different codes for each form in the formhandler.js. My question is there a way to execute them separately based on which form is being send currently?


#2

Or should i create two separate formhandler.js files?


#3

Also, correction: code should be under this line - $form.append("<div id=‘form-alert’…


#4

I’ve tried to add $("#firstform").(function() instead of $(function() at the start of formhandler.js

But it doesn’t work.


#5

Can someone help me with this, please?:scream:


#6

Helo @risen, instead of uses the Show Message in Success item:

image

Chose “Go to Page” and create a Thank you page, and in the header of that page put the tracking code.
In that way you just need to copy the Thank you page as many times you need and change the tracking code for each one.


#7

That’s a good idea! Thank you, friend!