External Form Tracking Integration

I have been working with forms for years and really hope I can get the Call Rail integration working. The problem I was having with external form integration involved validation. I had a <button type="submit">Submit Form</button> on my form seen here - https://www.abcautocare.com/estimates/

I have changed it to <button type="button" onclick="validateEST()" >Submit Form</button>

The validateEST() function checks to make sure all required form fields are completed. When all required form fields are completed, ONLY then do I used a js method .submit() to complete the form submission. 

On my end this is working beautifully! No more bots are submitting my forms. The trouble is that Call Rail is no longer recording my forms when they get submitted. 

Any suggestions? 

0

Comments

1 comment
Date Votes
  • Good morning, Thomas!

    After reviewing, it looks like the <button> element has a type of button . We believe that if the <button> is the last element in a <form> it will have a submit event by default, but <p> is the last element in this example.
     
    There are two fixes you could implement:
    • Add the following (your form_id is included in this script):
    <script> let form = document.querySelector('#estFORM');
    form.addEventListener(
     'submit',
     function() {
       CallTrk.captureForm('#estFORM');
     }
    );</script>
     
    OR
    • Update <button> type to submit
    Please let me know if this resolves your issue! If you have any further questions, we're more than happy to help. 
    0

Please sign in to leave a comment.

Didn't find what you were looking for?

New post