Last Updated: February 25, 2016
·
2.711K
· dubrod

MODX FormIt Basic Form

[[!FormIt?
&hooks=`spam,email,redirect`
&emailTpl=`SendEmailChunk`
&emailTo=`info@domain.com`
&emailUseFieldForSubject=`1`
&redirectTo=`9`
&validate=`name:required,
  email:email:required,
  subject:required,
  text:required:stripTags`
 ]]

[[!+fi.error_message:notempty=`<p>[[!+fi.error_message]]</p>`]]

<form action="[[~[[*id]]]]" method="post" class="contactForm">
<input type="hidden" name="nospam:blank" value="" />
<div> 
<label for="name">
    Name:
    <span class="error">[[!+fi.error.name]]</span>
</label>
<input type="text" name="name" id="name" value="[[!+fi.name]]" />
</div>
<div> 
<label for="email">
    Email:
    <span class="error">[[!+fi.error.email]]</span>
</label>
<input type="text" name="email" id="email" value="[[!+fi.email]]" />
</div>
<div> 
<label for="subject">
    Subject:
    <span class="error">[[!+fi.error.subject]]</span>
</label>
<input type="text" name="subject" id="subject" value="[[!+fi.subject]]" />
</div>
<br class="clear" />
<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>

<br class="clear" />
<input type="submit" value="Send Contact Inquiry" class="submitBtn" />
</form>

SendEmailChunk

<br />[[+name]] ([[+email]]) <br />
Wrote: <br /> 
[[+text]]

Extra Variables to switch out

&emailSubject=`Some Sucker Bought Another CDO`
&emailTo=`sales@mortgagemoney.com`
&emailCC=`boss@mortgagemoney.com`
&emailBCC=`fbi@gov.com`