MODX 2.7.3
Bootstrap 4.5.0
Formit 4.2.5
Simple contact form using FormIt example with few mods:
Here’s my call:
[[!FormIt?
&submitVar=`contactform`
&hooks=`spam,email,redirect`
&emailTpl=`contactTpl`
&emailTo=`me@myemail.com`
&redirectTo=`35`
&validate=`name:required,email:email:required,subject:required,text:required:stripTags`]]
<div>[[!+fi.validation_error_message:notempty=`<p>[[!+fi.validation_error_message]]</p>`]]</div>
<form class="form" action="[[~[[*id]]]]" id="contactform" method="post">
<input name="contactform" type="hidden" value="1" />
<div class="form-group">
<label for="name"> Name:(required)<span class="error text-danger">[[!+fi.error.name]]</span></label>
<input id="name" class="form-control" name="name" type="text" value="[[!+fi.name]]" />
</div>
<div class="form-group">
<label for="email"> Email:(required)<span class="error text-danger">[[!+fi.error.email]]</span></label>
<input id="email" class="form-control" name="email" type="text" value="[[!+fi.email]]" />
</div>
<div class="form-group">
<label for="subject"> Subject:(required)<span class="error text-danger">[[!+fi.error.subject]]</span></label>
<input id="subject" class="form-control" name="subject" type="text" value="[[!+fi.subject]]" />
</div>
<div class="form-group">
<label for="text"> Message:(required) <span class="error text-danger">[[!+fi.error.text]]</span></label>
<textarea id="text" class="form-control" name="text" rows="5">[[!+fi.text]]</textarea>
</div>
<button class="btn btn-primary" type="submit">Submit</button>
</form>
Here’s what’s happening:
The initial FormIt that I wrote - similar to this, a bit different validation, works. But if I change anything such as adding CC or BCC or changing validation it fails and renders a blank page. This behavior happens as long as I put the FormIt call and form directly in the content area.
If I use a chunk for all of the FormIt content the page renders with the form on top followed by a correct rendering of the page. And the form works fine - the page is totally broken.
I’m sure I’m using the submitVar wrong, but this form didn’t work initially and submitVar has since been removed. Suggestion on using that correctly would be very kind.
I’ve done a lot of troubleshooting based on what is on the forum as well as thoroughly scrubbing the template markup and code. Every other page on the site works fine. I’m ready for some help.
Thanks,