We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 54082
    • 5 Posts
    Hello Everyone, I'm working on something in FormIT. I followed directions and tutorial on how to create a form that will send to email. but it doesn't take effect at all. Please help me on what seems to be the problem in my code. Thank you very much for your help.


    [[!FormIt?
    &hooks=`recaptcha,spam,email,redirect,FormItSaveForm`
    &formName=`Contact Form`
    &emailTpl=`ChemicalDistributorAndSupplierFormTpl`
    &emailSubject=`Admin - Nexeo Contact Form!`
    &emailTo=`[email protected]`
    &redirectTo=`123`
    &validate=`
    fname:required,
    lname:required,
    email:email:required,
    company:required,
    phone:required,
    province:required,
    subject:required,
    message:required:stripTags,
    select1:required,
    select2:required`
    ]]

    <div style="border: 2px solid #d5d5d5; background-color: #f3f3f3; width: 400px; margin: 0 auto; padding: 1em; font-family: Lato;">


    [[!+fi.validation_error_message:notempty=`<p>[[!+fi.validation_error_message]]</p>`]]

    <form action="[[~[[*id]]]]" method="post" class="form">
    <h1 style="font-size: 32px; color: green; text-align: center;">Have a Question?</h1>
    <p style="text-align: center; padding: 15px;">Fill out the form below to be contracted by a Sales team Member</p>
    <input type="hidden" name="nospam" value="" />

    <p style="text-align: center;">
    <input style="width: 45%; border: 1px solid #d5d5d5; padding: 5px; color: #878585;" type="text" value="[[!+fi.fname]]" name="fname" id="fname" placeholder="First Name*"/>
    <input style="width: 45%; border: 1px solid #d5d5d5; padding: 5px; color: #878585;" type="text" value="[[!+fi.lname]]" name="lname" id="fname" placeholder="Last Name*" />
    </p>
    <p style="text-align: center;">
    <span class="error" style="font-size:10px;color:red;float:left;position:relative;left:20px;">[[!+fi.error.fname]]</span>
    <span class="error" style="font-size:10px;color:red;position:relative;left:5px;">[[!+fi.error.lname]]</span>
    </p>
    <p style="text-align: center;">
    <input style="width: 91%; border: 1px solid #d5d5d5; padding: 5px; color: #878585;" type="text" value="[[!+fi.email]]" name="email" id="email" placeholder="Email Address*"/>
    </p>
    <p style="text-align: center;">
    <span class="error" style="font-size:10px;color:red;float:left;position:relative;left:20px;">[[!+fi.error.email]]</span>
    </p>
    <p style="text-align: center;">
    <input style="width: 91%; border: 1px solid #d5d5d5; padding: 5px; color: #878585;" type="text" value="[[!+fi.company]]" name="company" id="company" placeholder="Company Name"/>
    </p>
    <p style="text-align: center;">
    <span class="error" style="font-size:10px;color:red;float:left;position:relative;left:20px;">[[!+fi.error.company]]</span>
    </p>
    <p style="text-align: center;">
    <input style="width: 91%; border: 1px solid #d5d5d5; padding: 5px; color: #878585;" type="text" value="[[!+fi.phone]]" name="phone" id="phone" placeholder="Phone Number"/>
    </p>
    <p style="text-align: center;">
    <span class="error" style="font-size:10px;color:red;float:left;position:relative;left:20px;">[[!+fi.error.phone]]</span>
    </p>
    <p style="text-align: center;">
    <input style="width: 91%; border: 1px solid #d5d5d5; padding: 5px; color: #878585;" type="text" value="[[!+fi.province]]" name="province" id="province" placeholder="State/Province*"/>
    </p>
    <p style="text-align: center;">
    <span class="error" style="font-size:10px;color:red;float:left;position:relative;left:20px;">[[!+fi.error.province]]</span>
    </p>

    <p style="padding: 0 20px 0 20px; font-size: 14px;">Has you current company purchased from Nexeo Solutions in the past?</p>
    <select style="width: 90%; left: 20px; position: relative; padding: 5px; color: #878585;" name="select1" value="[[!+fi.select1]]">
    <option value="">Select an option...</option>
    <option value="one" [[!+fi.select1:FormItIsSelected=`yes`]]>Yes</option>
    <option value="two" [[!+fi.select1:FormItIsSelected=`no`]]>No</option>
    </select>
    </p>
    <p style="padding: 0 20px 0 20px; font-size: 14px;">
    What is your end market?</p>
    <select style="width: 90%; left: 20px; position: relative; padding: 5px; color: #878585;" name="select2" value="[[!+fi.select2]]">
    <option value="">Select an option...</option>
    <option value="one" [[!+fi.select2:FormItIsSelected=`yes`]]>Yes</option>
    <option value="two" [[!+fi.select2:FormItIsSelected=`no`]]>No</option>
    </select>
    </p>
    <p style="text-align: center;">
    <textarea style="width: 91%; padding: 5px; color: #878585;" name="message" id="message" rows="6" cols="25" placeholder="Message" value="[[!+fi.message]]">[[!+fi.message]]</textarea>
    </p>
    <p style="text-align: center;">
    <span class="error" style="font-size:10px;color:red;float:left;position:relative;left:20px;">[[!+fi.error.message]]</span>
    </p>
    <br class="clear" />
    [[!+formit.recaptcha_html]]
    [[!+fi.error.recaptcha]]

    <br class="clear" />

    <div class="form-buttons">
    <p style="text-align: center;">
    <input style="font-size: 20px; text-transform: uppercase; color: #fff; background-color: #1f8c37; border: 1px solid; height: 5%; width: 90%;" type="submit" value="Send" />
    </p>
    </div>
    </form>
    </div>


    ----------------------------------------------------------------------------------------------------------------

    FOR THE ChemicalDistributorAndSupplierFormTpl

    Full Name: [[+fname]] [[+lname]]

    Email: [[+email]]

    Company Name: [[+company]]

    Phone: [[+phone]]

    State/Province: [[+province]]

    Has you current company purchased from Nexeo Solutions in the past? [[+select1]]

    What is your end market? [[+select2]]


    Message: [[+message]]


      • 3749
      • 24,544 Posts
      First, install the QuickEmail extra to make sure your email system works, unless you're already sure it does.

      Second, try taking out the captcha and spam hooks to see if that gets things working. If a FormIt hook fails, the ones after it won't execute.

      In my experience, the most common cause of trouble sending email is with the email sender (emailFrom) field.

      People often use the email of the person who is filling out the form as the email sender so they can reply to the email. This usually doesn't work because that person doesn't have an email account at your host. Instead, use your own email at the host as the sender and the form-filler's email address for the reply-to field.
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 17301
        • 932 Posts
        You have subject as a required field in your formit call but no input for subject exists. Removing this as a requirement will make it work.
          ■ email: [email protected] | ■ website: https://alienbuild.uk

          The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.
          • 3749
          • 24,544 Posts
          Good catch LK. smiley
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting