<![CDATA[ Cannot get my contact form to validate - My Forums]]> https://forums.modx.com/thread/?thread=47679 <![CDATA[Re: Cannot get my contact form to validate]]> https://forums.modx.com/thread/47679/cannot-get-my-contact-form-to-validate?page=3#dis-post-275507
Thank you both for your helpful suggestions. I just figured out the problem! I stupidly had a Javascript running on the contact form div from a previous form I had been implementing there. Very sloppy not to have removed that before!

The error messages are being displayed now, and the form is submitting correctly.

The only thing I have to figure out now is how to show the errors, as pressing the submit button reloads the page without the collapsible div expanded. Any suggestions would be appreciated!

Thanks again guys.

P.S.

I have removed my email address from my previous post - thank you for that suggestion!]]>
niclaw10 Mar 13, 2011, 01:31 PM https://forums.modx.com/thread/47679/cannot-get-my-contact-form-to-validate?page=3#dis-post-275507
<![CDATA[Re: Cannot get my contact form to validate]]> https://forums.modx.com/thread/47679/cannot-get-my-contact-form-to-validate?page=3#dis-post-275506 but you should remove/mask your email address from your forum post, you’re just inviting spam smiley

]]>
einsteinsboi Mar 12, 2011, 05:31 PM https://forums.modx.com/thread/47679/cannot-get-my-contact-form-to-validate?page=3#dis-post-275506
<![CDATA[Re: Cannot get my contact form to validate]]> https://forums.modx.com/thread/47679/cannot-get-my-contact-form-to-validate?page=3#dis-post-275505
Another thing to check (usually, but not in this case) is that your CSS has a .error class and doesn’t hide it.]]>
odeclas Mar 12, 2011, 02:54 PM https://forums.modx.com/thread/47679/cannot-get-my-contact-form-to-validate?page=3#dis-post-275505
<![CDATA[Re: Cannot get my contact form to validate]]> https://forums.modx.com/thread/47679/cannot-get-my-contact-form-to-validate?page=2#dis-post-275504
Thank you for those suggestions, I’ll try them out and let you know how I got on.

The form does submit in its current state, even though it might not appear to. I received your email as proof!

Thanks again.]]>
niclaw10 Mar 12, 2011, 02:37 PM https://forums.modx.com/thread/47679/cannot-get-my-contact-form-to-validate?page=2#dis-post-275504
<![CDATA[Re: Cannot get my contact form to validate]]> https://forums.modx.com/thread/47679/cannot-get-my-contact-form-to-validate?page=2#dis-post-275503
You might want to add a &successmessage=`Form submitted` or something while you’re testing (or add in a redirect hook). You could also change the ^2^ back to backticks `2` and specify an &errTpl=`[[+error]]` while testing. Sometimes I find snippets are a bit sniffy about the order of parameters, so you could move the &validate to the top.]]>
odeclas Mar 12, 2011, 02:35 PM https://forums.modx.com/thread/47679/cannot-get-my-contact-form-to-validate?page=2#dis-post-275503
<![CDATA[Re: Cannot get my contact form to validate]]> https://forums.modx.com/thread/47679/cannot-get-my-contact-form-to-validate?page=2#dis-post-275502
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.
]]>
niclaw10 Mar 12, 2011, 11:29 AM https://forums.modx.com/thread/47679/cannot-get-my-contact-form-to-validate?page=2#dis-post-275502
<![CDATA[Re: Cannot get my contact form to validate]]> https://forums.modx.com/thread/47679/cannot-get-my-contact-form-to-validate?page=2#dis-post-275501
Quote from: MichaelHarringtonDesigns at Mar 11, 2011, 01:39 PM

My contact form works fine now and validates laugh

I would like to do one last thing and that is change the submit button to my own image I have created.
This is the code I am using:

<div id="submit">
<input name="submit" class="submit" type="submit" value="Submit"/>
</div>

odeclas mention you can change the colour by using this code
input [type="submit"] { background-color: blue;}

What would be the code you would use to change the image of the submit button?

]]>
einsteinsboi Mar 11, 2011, 09:02 AM https://forums.modx.com/thread/47679/cannot-get-my-contact-form-to-validate?page=2#dis-post-275501
<![CDATA[Re: Cannot get my contact form to validate]]> https://forums.modx.com/thread/47679/cannot-get-my-contact-form-to-validate?page=2#dis-post-275500

I would like to do one last thing and that is change the submit button to my own image I have created.
This is the code I am using:

<div id="submit">
<input name="submit" class="submit" type="submit" value="Submit"/>
</div>

odeclas mention you can change the colour by using this code
input [type="submit"] { background-color: blue;}

What would be the code you would use to change the image of the submit button?
]]>
MichaelHarringtonDesigns Mar 11, 2011, 07:39 AM https://forums.modx.com/thread/47679/cannot-get-my-contact-form-to-validate?page=2#dis-post-275500
<![CDATA[Re: Cannot get my contact form to validate]]> https://forums.modx.com/thread/47679/cannot-get-my-contact-form-to-validate?page=2#dis-post-275499 einsteinsboi Mar 10, 2011, 12:46 PM https://forums.modx.com/thread/47679/cannot-get-my-contact-form-to-validate?page=2#dis-post-275499 <![CDATA[Re: Cannot get my contact form to validate]]> https://forums.modx.com/thread/47679/cannot-get-my-contact-form-to-validate?page=2#dis-post-275498
Is there any reason that the recaptcha graphics are rendered the way they are? I can’t tell you how many times my wife has called me over to help decipher form captcha "text"...]]>
Photowebmax Mar 10, 2011, 11:54 AM https://forums.modx.com/thread/47679/cannot-get-my-contact-form-to-validate?page=2#dis-post-275498