Formit validation issue

Hi there,

I’ve had a formit form running fine for a while.
Suddenly it won’t submit properly.
It says that there is a problem with the email field - even though when testing, a valid email address is being used.
I’ve tried turning off the validation but it still hangs on doesn’t send a notification email nor does it redirect to the ‘thanks’ page.

I can’t think of anything that could cause this, although I did upgrade from 2.8.6 to 2.8.7 some time ago - I didn’t think to test the form after this.

Has anyone experienced the same issue?

The strange thing is that it’s highlighting the email address as being invalid each time.

Thanks!

Are you sure the validation is the problem? Do you have any spam protection hooks that run and may cause the issue?

What’s the exact error message that gets displayed?

This might sound odd but check all the html on the page for overlapping or unclosed tags.

Are you able to put a sanitized version of the FormIt call in here (emails removed)? Be sure to put it inside code tags to make it readable.

Sometimes a password manager like LastPass will fill in a hidden spam field that’s supposed to be left empty.

1 Like

It did sound odd - but when i moved the form to a bare-bones template, it worked!
So I need to find what part of the HTML is causing the issue - it seems to be caused from my [[$header]] chunk - So i will dig around to see if there’s any bad /unclosed tags

Thanks for the steer!

Thanks - the Formit call is OK, because it works in an empty template, so I just need to figure out what in my template is throwing a wobbly!

Interesting - thanks Bob. Don’t think that’s the issue here based on the other suggestions I have just tried, but definitely worth worth bearing in mind with all forms as i didn’t know that.

That sounds like you may have some JS conflicting or some broken HTML. I’d lean toward JS. Anything happening in your browser console that looks like JS choking on something?

Right so I’ve gone through my header chunk to see what’s causing the conflict/error - and i’m confused to say the least - it’s this line:

	<base href="[[++site_url]]">

If I remove this line, the form submits!?

I can’t see what’s wrong with it?

What is the path of the [[++site_url]] when it’s rendered in source? Also, what’s the path on the action of the form in souce? If the path on the action of the form is not there.

Also, don’t cache your [[++site_url]]. System settings are saved to memory and do not need to be cached. It makes portability and multi-context sites much harder to manage.

Always use

<base href="[[!++site_url]]">

Thanks - So the rendered site_url is my domain as expected.

	<base href="https://www.mydomain.co.uk/">

The path for the form action is as per below:

<form id="ContactForm" action="[[~[[*id]]]]" method="post">

I just tried calling it uncached, and it seemed to submit the form this time!

Although the form isn’t sending the email notification for some reason.

When you say, “the form isn’t sending the email notification for some reason” do you mean that you know it’s not sending or you’re not seeing it hit your inbox? The latter could be the result of SPF issues or other email sending issues.

It’s an SMTP issue so working on that now, but the Base URL fixed the original issue so thanks!

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.