We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 46577
    • 54 Posts
    My first install of Formit on a new site (hosted by dot.ph), and can't get it to work. When the form is submitted there is no redirection and the browser just displays a blank page at the same url as the form. No email is sent.

    Here's my code which is a cut-down version of the instructions from http://rtfm.modx.com/extras/revo/formit/formit.tutorials-and-examples/formit.examples.simple-contact-page

    [[!FormIt?
       &hooks=`email,redirect`
       &emailTpl=`MyEmailChunk`
       &emailTo=`[[+email]]`
       &emailFrom=`[email protected]` /* changed to protect the innocent */
       &emailSubject=`Portofino FormIt Form`
       &redirectTo=`10`
       &validate=`name:required,
          email:email:required,
          subject:required,
          text:required:stripTags,`
    ]]
    
    <h2>Contact Form</h2>
     
    [[!+fi.validation_error_message:notempty=`<p>[[!+fi.validation_error_message]]</p>`]]
     
    <form action="[[~[[*id]]]]" method="post" class="form">
        <input type="hidden" name="nospam:blank" value="[[+fi.nospam]]" />
     
        <label for="name">
            Name:
            <span class="error">[[!+fi.error.name]]</span>
        </label>
        <input type="text" name="name" id="name" value="[[!+fi.name]]" /><br />
     
        <label for="email">
            Email:
            <span class="error">[[!+fi.error.email]]</span>
        </label>
        <input type="text" name="email" id="email" value="[[!+fi.email]]" /><br />
     
        <label for="subject">
            Subject:
            <span class="error">[[!+fi.error.subject]]</span>
        </label>
        <input type="text" name="subject" id="subject" value="[[!+fi.subject]]" /><br />
     
        <label for="text">
            Message:
            <span class="error">[[!+fi.error.text]]</span>
        </label>
        <textarea name="text" id="text" cols="55" rows="7" value="[[!+fi.text]]">[[!+fi.text]]</textarea><br /><br />
     
        <br class="clear" />
     
        <div class="form-buttons">
            <input type="submit" value="Send Contact Inquiry" />
        </div>
    </form>


    and my chunk:

    This is the Formit Email Chunk.
     
    <br />[[+name]] ([[+email]]) Wrote: <br />
     
    [[+text]]


    the test page can be viewed at http://portofino.com.ph/modx/test.html

    What I have tried:

    - Bob's QuickEmail snippet which works no problem (thanks Bob I sent you a donation)

    - a simple phpmail() snippet which works no problem

    <?php
    mail("[email protected]","php mail test","this works if you are reading it","From: [email protected]");


    - installing the same code at another site (hosted by hostgator) which works no problem http://outoftheblue.com.ph/modx/test.html

    I can only conclude there is nothing fundamentally wrong with my code, but rather something queer about the interaction of formit and the host.

    Any suggestions out there or do I just 'roll my own form' and abandon formit? Two days wasted on this already sad

    MODx 2.3.1 traditional
    MySQL 5.0.77
    PHP Mailer 5.2.8 (can't view phpinfo they have blocked it's use server-side) [ed. note: grogorio last edited this post 9 years, 8 months ago.]
    • Get rid of the extra comma
      text:required:stripTags,`

      As the Formit documentation says, if your Formit isn't working, first check your validation property.
        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
        • 46577
        • 54 Posts
        oops well spotted Sottwell, my bad. I have removed the offending comma but still no joy (and it's present on the hostgator site and doesn't seem to cause a problem there)

        A couple of other observations which might be pertinent, though I'm not sure:

        - I tried using smtp settings in MODx and that didn't work (although my phpmail snippet still worked ok)
        - When I received the mail sent via my phpmail snippet, the mail header showed the from address as [email protected] via domains.ph [ed. note: grogorio last edited this post 9 years, 8 months ago.]
          • 48806
          • 8 Posts

          I'm not really sure if I'm in the right thread or whether I'm asking a completely stupid question (although I've always told people that there is no such thing as a stupid question the older I've got the more I realise that there are plenty).

          I am working my way through a site which needs a contact form. Having been converted to / taught / told to use MODX by a good friend of mine who is a web developer I am trying to use Formit. It seems dead easy even when I combine it with Bootstrap.

          (my background is IT - big systems but as an Analyst and a Business Analyst at that - so little technical ability - then moved into management and had any remaining technical ability sucked out of my brain)

          I can get the form displayed (I'm using the following code )

          [[!FormIt?
          &hooks=`email,redirect`
          &emailTpl=`contactEmailTpl`
          &emailSubject=`Contact from Fred's Site Site`
          &emailTo=`[email protected]`
          &redirectTo=`15`
          ]]


          <div class="container" style="position:absolute;top:70px;left:120px;">
          <div class="row">
          <div class="col-md-6">
          <div class="well well-sm">
          <form class="form-horizontal" action="[[~[[*id]]]]" method="post">
          <fieldset>
          <legend class="text-center header">Contact us</legend>
          <div class="form-group">
          <div class="col-md-10 col-md-offset-1">
          <input id="fname" name="fname" type="text" value="[[!+fi.fname]]" placeholder="First Name" class="form-control">
          </div>
          </div>
          <div class="form-group">
          <div class="col-md-10 col-md-offset-1">
          <input id="lname" name="lname" type="text" value="[[!+fi.lname]]" placeholder="Last Name" class="form-control">
          </div>
          </div>

          <div class="form-group">
          <div class="col-md-10 col-md-offset-1">
          <input id="email" name="email" type="text" value="[[!+fi.email]]" placeholder="Email Address" class="form-control">
          </div>
          </div>

          <div class="form-group">
          <div class="col-md-10 col-md-offset-1">
          <input id="phone" name="phone" type="text" value="[[!+fi.phone]]" placeholder="Phone" class="form-control">
          </div>
          </div>

          <div class="form-group">
          <div class="col-md-10 col-md-offset-1">
          <textarea class="form-control" id="message" value="[[!+fi.message]]" name="message" placeholder="Enter your massage for us here. We will get back to you within 2 business days." rows="7"></textarea>
          </div>
          </div>

          <div class="form-group">
          <div class="col-md-12 text-center">
          <input type="submit" class="btn btn-primary btn-lg">Submit</input>
          </div>
          </div>
          </fieldset>
          </form>
          </div>
          </div>
          </div>
          </div>

          The tpl is :

          <h1>Contact From South Tree</h1>
          <p>This email was sent from the <a href="[[++site_url]]">fred's Site</a></p>

          <h2>Question or Comment</h2>
          <p>[[+message]]</p>

          <h2>Sender information</h2>
          <p>
          Name: [[+fname]] [[+lname]]

          Email: [[+email]]

          Phone: [[+phone]]

          </p>

          When I submit this code - I can fill in the fields press submit and I just get a blank version of the page on scren and no email is sent.

          I have followed this path so far

          STEP 1

          I checked the SMTP settings on my MODX System Manager and they are


          Authentification : Yes
          Helo : blank
          SMTP Hosts : just25.justhost.com
          Keep Alive : No
          Password : as per the account
          Port : 465
          Prefix : ssl
          Single To : No
          TimeOut : 10
          user : [email protected]
          Use SMTP : yes

          For completeness I am using

          MODX : 2.3.1-pl
          FormIt : FormIt 2.2.0
          Host : Justhost.com


          You will notice I had a redirect set - it didn't go to the redirect page (which does exist - triple checked the id every day for the last three days)

          So I dumped the code into a chunk and called the chunk in the resource. Checked I got the same result (which I did ) and the put a "Im Here message after the chunk"

          The message appeared but nothing else changed.


          STEP 2

          Downloaded Bob's QuickEmail snippet and put it in the content area of the resource. Ran it using [[!QuickEmail debug='1']]

          I also ran it with [[QuickEmail debug=`1`]] as in Modx 2.3 seems to indicate that snippets are called without a !

          Both types of call seemed to run for a minute then I go a screen back which was my blank content page (where the snippet was called in the content section)

          STEP 3

          We not sure really been working at this for a week now and I've nearly pulle whats left of my hair out


          Any suggestions? If you need more info then please let me know.


            • 46577
            • 54 Posts
            Wish I could report a solution here Coppereye but I ended up abandoning Formit for my project.

            It would be nice to get to the bottom of it though and just to reiterate a couple of my previous points in case it rings any bells out there:

            1. in my case at least it seemed to me to have something to do with the particular server where my install was - the same code on a shared Hostgator server setup worked like a charm

            2. as per my previous reply, a test mail snippet worked ok but I noticed in the received email header the following: "[email protected] via anotherdomain.ph" so I can only speculate that somehow Formit may have been choking on some interaction with the mail server.

            Hope this helps
              • 19872
              • 1,078 Posts
              I have found on some servers that a valid email address for the "From" must be used. Some servers have allowed me to make up a random user for the email address like "admin@mydomain.com", while at other hosts, I have had to actually created an email account for the email that the form comes from.

              After changing the SMTP setting, did you clear your site cache? From what I understand, if you make changes to any of the system settings, you must clear the cache for them to be implemented.

              Silly suggestion, but is your response page published?

              Not sure whether it makes a difference, but try changing the order of the Subject and the To, as in...
              Instead of:
              &emailSubject=`Contact from Fred's Site Site`
              &emailTo=`[email protected]`

              Try:
              &emailTo=`[email protected]`
              &emailSubject=`Contact from Fred's Site Site`

              Also — add an "email reply to" to your formit call.
              &emailReplyTo=`[[+email]]`
              The above will insert the email address you have set in your system settings. You can also inset an email address if you prefer to receive replies at a different email address. I like using placeholders as much as possible as it makes for much easier updating in the future—especially if you have multiple forms on your site.
                • 46208
                • 10 Posts
                Hi,

                I've had some issues too, form did not raise any validation error but did not success too.
                I can confirm that adding the &emailFrom in the FormIt snippet fixed the issue. I'm using auth smtp.

                Thank's for the tip, saved me hours !

                Cheers
                  • 46577
                  • 54 Posts
                  back again nearly 4 years later and formit (4.1.0-pl) has stopped working on sites where it was previously working fine.

                  Symptoms: no redirect, no error, no mail sent.

                  Tried all the suggestions here and in other threads but no success....
                    • 17301
                    • 932 Posts
                    Do you have anything in your error log? Have you tried creating a blank empty document with the bare minimum fields or even example contact page in the documentation to ensure formit is working ok?
                      ■ 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.
                      • 46577
                      • 54 Posts
                      Making progress, of sorts:

                      I read on another thread something about the PHP version on the server. In cPanel, I can select 3 versions: 5.4, 5.6 and 7.1.

                      It was set to 5.4, so I went bleeding edge and tried 7.1. Result, my form appears to submit ok and the redirect works however no email is received.

                      Then trying 5.6, everything works.

                      However no matter which version is selected, if I run Bob Ray's QuickEmail snippet, I see
                      Unauthorized

                      and just for completeness, when things are not working, in the core/cache/logs/error.log I see
                      (ERROR @ /home2/pghmin/public_html/core/components/formit/src/FormIt/Hook/Email.php : 303) [FormIt] An error occurred while trying to send the email. Could not instantiate mail function.

                      So it appears to work with PHP 5.6, however a bit of a concern that it's so choosy. And the QuickEmail not working in any circumstance? Baffled.