Help me figure out why FORMS is not tracking submissions

I had a developer create a simple redirect script that sends users to a page based on a postal (zipcode) the script works great, but whenever the form is submitted, I do not get an email alert and the submission data is not stored in /forms.

Can anyone offer a fix to solve this?

script start:

$(function() {
$(‘#wf-form-HomePage’).submit(function() {
var url = ‘/bookref’;
var pc = ($(‘#Postal-Code’).val() || ‘’).trim().toLowerCase();

// Duplicate more of these lines below to set more redirects

if(pc.includes(‘a’)) url = ‘/city/newfoundland-and-labrador’;
if(pc.includes(‘b’)) url = ‘/city/nova-scotia’;
if(pc.includes(‘b3’)) url = ‘/city/halifax’;

location.href = url;
return false;

});
});

script end
script start

$(‘a.Submit’).click(function (e) {
e.preventDefault(); // prevent default anchor behavior
var goTo = this.getAttribute(“href”); // store anchor href

setTimeout(function(){
     window.location = goTo;
},1500);

});

script end.

That typically happens with you change the Forms Action field or e.preventDefault(); (as your link click does). I’d check there first. What you posted isn’t really enough to see that.

Yeh, I found the dev, so hope he can fix! wish me luck…

1 Like

Did they manage to fix it? If not, send a link and I can see if I can help :slight_smile:

I never heard back from him. So not sure what’s going on. Here’s the link. On my home page, the zipcode form is using a script ‘in page’ in the; Before tag

https://preview.webflow.com/preview/insurecert?utm_medium=preview_link&utm_source=designer&utm_content=insurecert&preview=919e64d21f9b49b5d35e7f7f98a31481&mode=preview

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