We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36435
    • 40 Posts
    Hi guys.

    I've been through the forums and I've seen similar posts, but none of the solutions there seem to be working for me.

    I'm not getting any errors when I submit my forms - the page simply reloads (it's supposed to redirect to the home page for now) and on the address bar I see the post details:
    http://justimaging.co.ke/contact.html?name=joe&email=joseph%40justimaging.co.ke&text=Testing


    I've tried QUickMail and I'm getting the test email. I'm also using SMTP (same result if I don't use SMTP)

    Here's my code... what could I be doing wrong? This form is driving me quite mad...!

    [[!FormIt?
       &hooks=`email,redirect`
       &emailTpl=`MyEmailChunk` (changed)
       &emailTo=`[email protected]` (changed)
       &emailFrom=`[email protected]`
       &emailSubject=`Message from Just Imaging Website`
       &redirectTo=`1`
       &validate=`name:required,email:email:required,text:required:stripTags`
    ]]
    
    
    [[!+fi.validation_error_message:notempty=`<p>[[!+fi.validation_error_message]]</p>`]]
    
    <form id="contact-form">
    
    	<h2>Send us a message</h2>
    	<div class="row">
    		<div class="col-md-6">
    			<input type="text" name="name" id="name" placeholder="Name" value="[[!+fi.name]]" />
    			
    		</div>
    		<div class="col-md-6">
    			<input name="email" id="email" type="email" placeholder="Email"  value="[[!+fi.email]]">
    		</div>
    	</div>
    	<textarea name="text" id="text" placeholder="Message" value="[[!+fi.text]]">[[!+fi.text]]</textarea>
    
    	<div class="submit-area">
    		<input type="submit" id="submit_contact" value="Send Message">
    									
    	</div>
    </form>

    This question has been answered by sottwell. See the first response.

    • discuss.answer
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      I'm not sure exactly what the problem was, it failed for me as well. This works...
      [[!FormIt?
         &hooks=`email,redirect`
         &emailTpl=`MyEmailChunk`
         &emailTo=`[email protected]`
         &redirectTo=`1`
         &validate=`name:required,
            email:email:required,
            text:required:stripTags`]] 
       
      [[!+fi.validation_error_message:notempty=`<p>[[!+fi.validation_error_message]]</p>`]]
       
      <form action="[[~[[*id]]]]" method="post" class="form" id="contact-form"> 
          <h2>Send us a message</h2>
          <div class="row">
              <div class="col-md-6">
                  <input type="text" name="name" id="name" placeholder="Name" value="[[!+fi.name]]" />
                   
              </div>
              <div class="col-md-6">
                  <input name="email" id="email" type="email" placeholder="Email"  value="[[!+fi.email]]">
              </div>
          </div>
          <textarea name="text" id="text" placeholder="Message" value="[[!+fi.text]]">[[!+fi.text]]</textarea>
       
          <div class="submit-area">
              <input type="submit" id="submit_contact" value="Send Message">
                                           
          </div>
      </form>
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 36435
        • 40 Posts
        Thanks so much Sottwell.

        I still can't see where the difference is, but I'm happy. It's working now. Can't believe I've spent the better part of today staring at these few lines of code...!

        The ModX community rocks!
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Looking at it again, it may be that FormIt requires POST and by default forms will use GET. It's 1 AM here, and I'm too cross-eyed to check it out right now.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 36435
            • 40 Posts
            My Goodness! It's been staring at me right in the face all this time! You're right. My form tag didn't have the POST method! (I feel quite dumb now!)

            Thanks again for your help Sottwell!