Ok, I've given myself a nasty headache over this. FormIt just returns the form with the fields all filled in, so it's obviously mostly working. If you submit without filling in any fields, it append the error message to everything except the name field, moving the name field to the second position doesn't make any difference. The whole page validates, so I know it's not a bad form. Can anybody see what's wrong here?
http://c0157.paas2.tx.modxcloud.com/contact.html
[[!FormIt?
&hooks=`spam,email,redirect`
&emailTpl=`emailTpl`
&emailTo=`[email protected]`
&redirectTo=`1`
&validate=`name:required,
email:email:required,
msg:required:stripTags
]]
<h2>Contact Form</h2>
[[!+fi.error_message:notempty=`<p>[[!+fi.error_message]]</p>`]]
<form action="[[~[[*id]]]]" method="post" class="c-form">
<input type="hidden" name="nospam:blank" value="">
<label for="name">
Name
[[!+fi.error.name]]
</label>
<input type="text" name="name" id="name" value="[[!+fi.name]]">
<label for="email">
Email
[[!+fi.error.email]]
</label>
<input type="email" name="email" id="email" value="[[!+fi.email]]">
<label for="msg">
Message
[[!+fi.error.msg]]
</label>
<textarea id="msg" name="msg" rows="10" cols="60">[[!+fi.msg]]</textarea>
<input type="submit" value="Send" class="button green">
</form>
-
- 64 Posts
It seems to be working for me, or have I misunderstood your problem? I get the error message for the name field. The attached image is a screenshot where I just have clicked on the submit button.
I have no idea what the problem is with the above code. I completely re-wrote the content one line at a time, and it works just fine. Copy/paste this back in, and it stops working. I can't for the life of me see any difference at all in the snippet or the form. I think FormIt just doesn't like me.
I see it now! The validate property isn't closed!