We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19715
    • 3 Posts
    I’ve been scouring the forums for the last hour and a half for an answer. I can’t get FormIt to work. I get no errors (either on the form page or in the error log) and, no emails are sent. Instead the contact page (where I have the form) just reloads and clears the fields as if nothing had happened (I even tried turning off &clearFieldsOnSuccess). I checked the server emails by sending various test emails with various methods (in and out of MODx).

    My server/website stats are thus:
    OS: CentOS Linux
    Kernel: 2.6.18-194.3.1.el5
    Apache: 2.2.15
    PHP: 5.2.13
    MySQL: 5.1.51-log
    pdo_mysql: installed
    MODx Revolution: 2.0.4-pl2 (Traditional Version)
    FormIt: 1.5.3 rc2

    Browsers Checked: Chrome 10, Firefox 3.6, Firefox 4

    My code is as follows and are located on the same page. The FormIt code is at the top and the contact form is below it in a div that is initially hidden because I am using jQuery Tools Tabs.

    [[!FormIt? 
      &hooks=`email,redirect`
      &emailTpl=`Form`
      &emailTo=`[email protected]`
      &emailFromName=`[[+name]]`
      &emailFrom=`[[+email]]`
      &emailSubject=`Message from [[+name]]`
      &redirectTo=`/43`
      &validate=`name:required,
        title:required,
        company:required,
        address:required,
        email:email:required,
        phone:required`
    ]]
    


    <form class="form" action="/contact" method="post">
      <div class="contact_form">
        <h2>Contact Request Form</h2>
        [[!+fi.error.error_message:notempty=`<p>[[!+fi.error.error_message]]</p>`]]
        <p>
          <label for="name">Name <span class="error">[[!+fi.error.name]]</span></label><br>
          <input name="name" type="text">
        </p>
        <p>
          <label for="title">Title <span class="error">[[!+fi.error.title]]</span></label><br>
          <input name="title" type="text">
        </p>
        <p>
          <label for="company">Company <span class="error">[[!+fi.error.company]]</span></label><br>
          <input name="company" type="text">
        </p>
        <p>
          <label for="address">Address <span class="error">[[!+fi.error.address]]</span></label><br>
          <input name="address" type="text">
        </p>
        <p>
          <label for="email">Email <span class="error">[[!+fi.error.email]]</span></label><br>
          <input name="email" type="text">
        </p>
        <p>
          <label for="phone">Phone <span class="error">[[!+fi.error.phone]]</span></label><br>
          <input name="phone" type="text">
        </p>
        <p>
          <button>Submit</button>
        </p>
      </div>
    </form>
    



    Thanks!
    Bryan
    • &redirectTo=`/43` should probably be &redirectTo=`43`

      Maybe you should try uninstalling it and re-installing it. What version of MODx?
        • 19715
        • 3 Posts
        Thanks for the suggestion! Unfortunately, it did not work. My version is Revolution 2.0.4-pl2 (Traditional).

        I did try though on a whim placing the FormIt snippet on a different page and sending the form to that page. The email sent perfectly, but the redirect didn’t work at all. If I can figure out a way to get the back to the form page when there’s errors, this could work out fine.
          • 19715
          • 3 Posts
          Sorry to have a quick second reply, but I figured out what was wrong. It has something to do with friendly URLs.

          I noticed that when my pages were hidden from the menu, that the friendly URL would just forward to the index page. If I used the page ID though, it would work perfectly.

          I placed the FormIt Snippet back on the page with the form, and in the form I specified its own ID instead of the alias. This worked perfectly. Email, redirection, validation, everything I needed.

          So for right now, I can use the ID’s until I figure out why my aliases aren’t working.


          Cheers!