We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 42082
    • 72 Posts
    I seem to have done something wrong in my code with formit but I can't for the life of me figure out
    what is wrong with it here is my code.
    Any help would be very nice.


    <html>
    <head>
    
    </head>
    <body>
    [[!FormIt?
        &hooks=`email,redirect`
    	&emailTpl=`sentEmailTpl`
    	&emailSubject=`Message from One Way media`
    	&emailTo=`[email protected]`
        &redirectTo=`21` 
    	]]
    <form id="contactForm" class="cmxform" method="post" action="[[~[[*id]]]]">
       <strong>[[*description]]</strong>
       <br />
    	<div>
    	<label for="contact_name">Username </label><em>(required)</em><br />
    	<input id="contact_name" name="contact_name" size="30" class="required" minlength="2" value="[[!+fi.contact_name]]" />
       </div>
    	<div>
    	<label for="contact_email">E-Mail </label><em>(optional)</em><br />
    	<input id="contact_email" name="contact_email" size="30"  class="required email" value="[[!+fi.contact_email]]" />
    	</div>
        <div>
        <label for="favoritefood">Subject</label>
      <select name="Choose a Subject" id="subject" value="[[!+fi.contact_subject]]">
      <option selected="selected">--select--</option>
        <option>Moderator</option>
        <option>Request</option>
        <option>Comment</option>
        <option>Request</option>
          </select><em>(optional)</em>
    	</div>
    	<div>
    	<label for="contact_message">Your comment </label><em>(required)</em><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>
    </body>
    </html>
      • 28173
      • 409 Posts
      Did you try to uncache the snippet call ?
      [[FormIt?.... instead of [[!FormIt?...
      You can also try to uncache the resource
        • 33337
        • 3,975 Posts
        What is the error?
          Zaigham R - MODX Professional | Skype | Email | Twitter

          Digging the interwebs for #MODX gems and bringing it to you. modx.link
          • 42082
          • 72 Posts
          no I have not tried that but I will thanks for responding so quick
            • 42082
            • 72 Posts
            I don't get any email.
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              Do you have the sentEmailTpl chunk?
                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
                • 37042
                • 384 Posts
                Do any of your other forms send an email? I had similar issue and was referred to BobRays email snippet.
                http://bobsguides.com/quickemail-snippet-tutorial.html
                  ...
                  • 42082
                  • 72 Posts
                  yes sottwell here it is:
                  sentEmailTpl:
                  <p>[[+contact_name]] sent you this message on the Contact Administrator page:</p> 
                  <br />
                  <h1>Subject: [[+contact_subject]]</h1>
                  <strong>[[+contact_message]]</strong>
                  <br />
                  <p>You can respond to [[+contact_name]] by email at <a href="mailto:[[+contact_email]]">[[+contact_email]]</a>.</p>


                  and elednova
                  none of my other forms send emails
                    • 10208 ☆ A M B ☆
                    • 1,780 Posts
                    Your code works as expected.

                    I just ran your code through by using chunks for the form and the emailTpl, changed the emailTo address to mine, and tested the form. It redirected and sent a successful email.
                    (note: html, head, and body wrappers were removed)

                    The email came through like this:
                    frogabog sent you this message on the Contact Administrator page:



                    Subject: [[+contact_subject]]
                    comments

                    You can respond to frogabog by email at [email protected].

                      Frogabog- MODX Websites in Portland Oregon
                      "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
                      Having server issues? These guys have MODX Hosting perfected - SkyToaster
                      • 28042 ☆ A M B ☆
                      • 24,524 Posts
                      Then you'll need to find out why you can't send mail from your site. That could be any number of reasons. The best thing to do now is to install Bob's QuickEmail package and troubleshoot your email system.
                        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