Hi Everyone,
I too have been experiencing problems with my contact form validation. The form does validate, that is field entries that are out-with the defined parameters cause the email not to be sent. However, I am really struggling with trying to get the error messages to show up.
I have gone over and over all that has been posted here, and in the comments on lesson 9 at the (excellent) coding pad which concerns FormIt.
I would greatly appreciate your help with this as I’m feeling pretty stuck.
I have placed the code for the form in a chunk which is called in my template. Please see www.caitlinmorrisimages.com (and click on "contact") to see how I have tried to implement this.
My code is as follows:
<!--Contact Heading-->
<p><i><strong>Any Questions?</strong></i></p><p>Fill out the form below and we will get back to you as soon as possible.</p>
<div style="width:100%; border-bottom:#e6e6e5 8px solid;"></div>
<!--Contact Form-->
<!--Form Code-->
[[!FormIt?
&hooks=`email`
&emailTpl=`sentEmailTpl`
&emailSubject=`Enquiry from Caitlin Morris Images Website`
&emailTo=`---------------------------`
&validate=`contact_name:required:minLength=^2^,
contact_email:email:required,
contact_message:required`
&submitVar=`submit`
]]
<!--o-->
<div id="con_form">
<form id="contactForm" class="cmxform" method="post" action="[[~[[*id]]]]">
<div style="margin-top:20px;">
<label for="contact_name">Name</label><br />
<p>[[!+fi.error.contact_name]]</p><br />
<input id="contact_name" class="required" name="contact_name" size="30" value="[[!+fi.contact_name]]" />
</div>
<div style="margin-top:20px;">
<p>[[!+fi.error.contact_email]]</p>
<label for="contact_email">E-Mail</label><br />
<input id="contact_email" name="contact_email" size="30" class="required" value="[[!+fi.contact_email]]" />
</div>
<div style="margin-top:20px;">
<p>[[!+fi.error.contact_message]]</p>
<label for="contact_message">Your Message</label><br />
<textarea id="contact_message" name="contact_message" cols="70" rows="7" class="required">[[!+fi.contact_message]]</textarea>
</div>
<div>
<input name="submit" class="submit" type="submit" value="submit"/>
</div>
</form>
</div>
Thank you very much in advance.