I have a contact form on my site. I use formit for its FormIT validation. I want email be not more than 40 characters, be reqired and be correct email address. Message
field is required too and has max length set.
Validator doesn't work correctly:
- When required fields are empty, it shows error message and doesn't allow to send the form (this situation is absolutely correct)
When in
email
is any text (valid or not), form is sent but redirect to success page doesn't work (so it happens also when we enter more than max length)[[!FormIt? &hooks=`spam,email,redirect,FormItAutoResponder` &emailTpl=`emailTplContact` &emailSubject=`Message from site.com` &emailTo=`myemail@gmail.com` &validate=`email:email:required:maxLength=^40^, message:required:maxLength=^150^` &redirectTo=`11` &fiarTpl=`emailAutoRespond` &fiarSubject=`Your message is sent` &fiarFromName=`My Site` &fiarFrom=`myemail@gmail.com` &fiarToField=`email` &fiarReplyTo=`email` ]] <form id="contact-form" method="post" action="[[~[[*id]]]]" enctype="application/x-www-form-urlencoded" role="form" data-toggle="validator" name="order"> <input type="text" id="name" name="name" type="name" placeholder="Name" value="[[!+fx.name]]" size=25> <input type="text" required="required" type="email" id="email" name="email" placeholder="Email" value="[[!+fx.email]]"> [[!+fx.error.email]] <textarea required="required" placeholder="Message" id="message" name="message">[[!+fx.message]]</textarea> <button name="send">Send</button> </form> </div>
email:maxLength=^40^
I know you are supposed to be able to chain multiple validators together, but it just might be having issues with the email:email:required:maxLength – Sean Kimball