Execute code after form is posted (formhandler.js)

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?

Or should i create two separate formhandler.js files?

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

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

But it doesn’t work.

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

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.

2 Likes

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