FormIt simply not working

Summary

I’ve installed FormIt (4.2.5) on my site (2.7.1). I’ve set everything up as per the Simple Contact Form example https://docs.modx.com/current/en/extras/formit/formit.tutorials-and-examples/examples.simple-contact-page

I have installed and run QuickEmail which works fine.

I also created a quick PHP email process script myself, which also works fine.

Lastly I turned off mod_sec.

Step to reproduce

Set up form as per tutorial minus recaptcha https://docs.modx.com/current/en/extras/formit/formit.tutorials-and-examples/examples.simple-contact-page

My FormIt call looks like:

[[!FormIt?
    &hooks=`spam,email,redirect`
    &emailTpl=`EmailTPL`
    &emailFrom=`noreply@mysite.com`
    &emailFromName=`Me`
    &emailTo=`me@mysite.com`
    &redirectTo=`7`
    &validate=`name:required,
      email:email:required,
      text:required:stripTags,`
  ]]

My form chunk looks like:

    [[!+fi.validation_error_message:notempty=`<p>[[!+fi.validation_error_message]]</p>`]]
<form action="[[~[[*id]]]]" method="post" class="form">
    <input type="hidden" name="nospam" value="" />
 
    <label for="name">
        Name:
        <span class="error">[[!+fi.error.name]]</span>
    </label>
    <input type="text" name="name" id="name" value="[[!+fi.name]]" />
 
    <label for="email">
        Email:
        <span class="error">[[!+fi.error.email]]</span>
    </label>
    <input type="text" name="email" id="email" value="[[!+fi.email]]" />
 
    <label for="subject">
        Organization (optional):
        <span class="error">[[!+fi.error.businessName]]</span>
    </label>
    <input type="text" name="businessName" id="businessName" value="[[!+fi.businessName]]" />
 
    <label for="text">
        Message:
        <span class="error">[[!+fi.error.text]]</span>
    </label>
    <textarea name="text" id="text" cols="55" rows="7" value="[[!+fi.text]]">[[!+fi.text]]</textarea>
 
    <div class="form-buttons">
        <button class="btn btn--primary" type="submit">Send</button>
    </div>
</form>

Observed behavior

Nothing happens - no validation, no redirection, no email sent, no console errors.

Expected behavior

I expect validation to work, page to be redirected and email sent.

Environment

FormIt (4.2.5), MODX (2.7.1) on LAMP stack.

Any help is much appreciated! Many thanks!

While it shouldn’t be needed, I usually try to be explicit about the &submitVar - a variable that needs to exist inside the form for it to trigger FormIt.

For example:

[[!FormIt?
    &submitVar=`my-form`
    &hooks=`spam,email,redirect`
    &emailTpl=`EmailTPL`
    &emailFrom=`noreply@mysite.com`
    &emailFromName=`Me`
    &emailTo=`me@mysite.com`
    &redirectTo=`7`
    &validate=`name:required,
      email:email:required,
      text:required:stripTags,`
  ]]

and:

<form action="[[~[[*id]]]]" method="post" class="form">
   <input type="hidden" name="my-form" value="1">

It’s also worthwhile inspecting the request using the browser develpment tools. Is it actually using a POST? Is it not redirecting (for example from http to https or (non-)www)?

What happens if you remove the last comma from the following - after stripTags…
[[!FormIt? &hooks=spam,email,redirect &emailTpl=EmailTPL &emailFrom=noreply@mysite.com &emailFromName=Me &emailTo=me@mysite.com &redirectTo=7 &validate=name:required,
email:email:required,
text:required:stripTags, ]]

Make snippet call as simple as possible, remove all unnecessary and optional parameters and check again.

[[!FormIt?
&submitVar=`my-form`
&hooks=`email`
&emailTpl=`EmailTPL`
&emailFrom=`noreply@mysite.com`
&emailTo=`me@mysite.com`  ]]