We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8772
    • 13 Posts
    Hi, I’m trying to get my portfolio site running in MODx... I feel ridiculous embarrassed posting about a measly e-mail form but I just can’t get it to work after several hours of reading the docs and forum.

    I submit and all I get is a page refresh not even a page refresh. Hope someone can help.

    Here’s my snippet call:


    [!eForm? &formid=`contactForm` &debug=`1` &to=`[email protected]` &subject=`bla` &tpl=`feedbackForm` &report=`feedbackReport`!]
    



    Here’s my template chunk (called feedbackForm):

    [+debugText+]
    
    [+validationMessage+]
    <form method="post" action="[~[*id*]~]">
    <p>
    <input type="hidden" name="formid" value="contactForm" />
    <label for="nombre">Nombre: </label>
    <input id="nombre" name="nombre" class="rounded" type="text" eform="Nombre::1" />
    </p>
    <p>
    <label for="email">E-mail: </label>
    <input id="email" name="email" class="rounded" type="text" eform="E-mail:email" />
    </p>
     <p>
    <label for="asunto">Asunto: </label>
    <input id="asunto" name="asunto" class="rounded" type="text" eform="Asunto::1" />
    </p>
    <p>
    <label for="mensaje">Mensaje: </label>
    <textarea id="mensaje" name="mensaje" rows="10" cols="20" class="rounded" eform="Mensaje:textarea"></textarea>
    </p>
    <p>
    <input class="submit rounded" type="submit" name="submit" value="Enviar" />
    </p>
     </form>
    


    Here’s my report chunk (called feedbackReport):

    <p>Nombre: [+nombre+]</p>
    <p>E-mail: [+email+]</p>
    <p>Asunto: [+asunto+]</p>
    <p>Mensaje:</p>
    <p>[+mensaje+]</p>
    


    Here’s my debug
    (I’ve changed a couple things I don’t want to post publicly on the forum):

    WARNING - DEBUGGING IS ON
    Make sure you turn debugging off before making this form live!
    'formid' passed using rule: #VALUE contactForm, (input=contactForm)
    
    eForm configuration:
    
    array (
      'snipPath' => 'path to my... /public_html/assets/snippets/eform/',
      'snipFolder' => 'eform',
      'vericode' => '',
      'formid' => 'contactForm',
      'from' => '[email protected]',
      'fromname' => 'Site name',
      'to' => '[email protected]',
      'cc' => '',
      'bcc' => '',
      'subject' => 'bla',
      'ccsender' => '0',
      'sendirect' => '0',
      'mselector' => '0',
      'mobile' => '',
      'mobiletext' => '',
      'autosender' => '',
      'autotext' => '',
      'category' => '0',
      'keywords' => '',
      'gid' => '10',
      'noemail' => '',
      'saveform' => '1',
      'tpl' => 'feedbackForm',
      'report' => 'feedbackReport',
      'allowhtml' => '0',
      'replyto' => '',
      'language' => 'english',
      'thankyou' => '',
      'isDebug' => '1',
      'reportAbuse' => '',
      'disclaimer' => '',
      'sendAsHtml' => '',
      'sendAsText' => '',
      'sessionVars' => '',
      'postOverides' => '0',
      'eFormOnBeforeMailSent' => '',
      'eFormOnMailSent' => '',
      'eFormOnValidate' => '',
      'eFormOnBeforeFormMerge' => '',
      'eFormOnBeforeFormParse' => '',
      'cssStyle' => '',
      'jScript' => '',
      'submitLimit' => '0',
      'protectSubmit' => '1',
      'requiredClass' => 'required',
      'invalidClass' => 'invalid',
      'runSnippet' => '',
      'autoSenderName' => '',
      'version' => '1.4.4',
    )
    




    Some things I’ve tried:


    • Changing the action to action="[(site_url)][~10~]" and other variants with base_url, hardcoding, etc. I did this because the document is not in the site root but in the second level
    • Removing all parameters except required
    • Sending an e-mail from MODx manager to see if its a server thing (works fine)
    • Sending a test e-mail using simple PHP in a snippet (works fine)

    I’m on a shared host, by the way. Thanks in advance for any ideas.
      • 8772
      • 13 Posts
      Hi again,

      I just tried sending the form with no required fields, like this:

      [+validationMessage+]
      <form method="post" action="[(site_url)][~10~]">
      <p>
      <input type="hidden" name="formid" value="contactForm" />
      <label for="nombre">Nombre: </label>
      <input id="nombre" name="nombre" class="rounded" type="text" eform="Nombre" />
      </p>
      <p>
      <label for="email">E-mail: </label>
      <input id="email" name="email" class="rounded" type="text" eform="E-mail" />
      </p>
       <p>
      <label for="asunto">Asunto: </label>
      <input id="asunto" name="asunto" class="rounded" type="text" eform="Asunto" />
      </p>
      <p>
      <label for="mensaje">Mensaje: </label>
      <textarea id="mensaje" name="mensaje" rows="10" cols="20" class="rounded" eform="Mensaje"></textarea>
      </p>
      <p>
      <input class="submit rounded" type="submit" name="submit" value="Enviar" />
      </p>
       </form>
      



      ...and it works so I guess thats the problem but I don’t know what I’m doing wrong.

      Here’s the code that doesn’t work for me:

      [+validationMessage+]
      <form method="post" action="[(site_url)][~10~]">
      <p>
      <input type="hidden" name="formid" value="contactForm" />
      <label for="nombre">Nombre: </label>
      <input id="nombre" name="nombre" class="rounded" type="text" eform="Nombre::1" />
      </p>
      <p>
      <label for="email">E-mail: </label>
      <input id="email" name="email" class="rounded" type="text" eform="E-mail:email:1" />
      </p>
       <p>
      <label for="asunto">Asunto: </label>
      <input id="asunto" name="asunto" class="rounded" type="text" eform="Asunto::1" />
      </p>
      <p>
      <label for="mensaje">Mensaje: </label>
      <textarea id="mensaje" name="mensaje" rows="10" cols="20" class="rounded" eform="Mensaje::1"></textarea>
      </p>
      <p>
      <input class="submit rounded" type="submit" name="submit" value="Enviar" />
      </p>
       </form>
      



      Anyone see what might be wrong doing it this way?
        • 33337
        • 3,975 Posts
        What error u get?

        Other than this, try adding data type in the validation parameters: eg. eform="Nombre:string:1"
          Zaigham R - MODX Professional | Skype | Email | Twitter

          Digging the interwebs for #MODX gems and bringing it to you. modx.link
          • 8772
          • 13 Posts
          Hi, thank you so much for answering. I have to fix this before the week ends so I really appreciate any help I could get.

          Actually, I don’t get any errors at all. That’s why I used the debug for a while. The results from debugging are in my first post. Every time I tried something new, I got the same debug and it didn’t provide any useful clues, at least that I could think of.

          This does not do anything:

          [+debugText+]
          
          [+validationMessage+]
          <form method="post" action="[(site_url)][~10~]">
          <p>
          <input type="hidden" name="formid" value="contactForm" />
          <label for="nombre">Nombre: </label>
          <input id="nombre" name="nombre" class="rounded" type="text" eform="Nombre:string:1" />
          </p>
          <p>
          <label for="email">E-mail: </label>
          <input id="email" name="email" class="rounded" type="text" eform="E-mail:email:1" />
          </p>
           <p>
          <label for="asunto">Asunto: </label>
          <input id="asunto" name="asunto" class="rounded" type="text" eform="Asunto:string:1" />
          </p>
          <p>
          <label for="mensaje">Mensaje: </label>
          <textarea id="mensaje" name="mensaje" rows="10" cols="20" class="rounded" eform="Mensaje:string:1"></textarea>
          </p>
          <p>
          <input class="submit rounded" type="submit" name="submit" value="Enviar" />
          </p>
           </form>
          


          Not even a page refresh. I’ve even tried validating my code just in case there was something wrong in the HTML.

          Also, when I send the form with no validation and in the snippet I say &from=`[+asunto+]` the mail is delivered with a subject of 0. Yeah that’s a zero.

          Any other ideas?

            • 28042 ☆ A M B ☆
            • 24,524 Posts
            What does the form look like in the actual page’s "view source"?
              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
              • 8772
              • 13 Posts
              Hi Susan, thanks for popping in. And thank you for your online documentation and tutorials, by the way. They really helped me get started with MODx.


              With this chunk:

              [+debugText+]
              
              [+validationMessage+]
              
              <form method="post" action="[(site_url)][~10~]">
              <p>
              <input type="hidden" name="formid" value="contactForm" />
              <label for="nombre">Nombre: </label>
              <input id="nombre" name="nombre" class="rounded" type="text" value="" eform="Nombre:string:1" />
              </p>
              <p>
              <label for="email">E-mail: </label>
              <input id="email" name="email" class="rounded" type="text" value="" eform="E-mail:email:1" />
              </p>
               <p>
              <label for="asunto">Asunto: </label>
              <input id="asunto" name="asunto" class="rounded" type="text" value="" eform="Asunto:string:1" />
              </p>
              <p>
              <label for="mensaje">Mensaje: </label>
              <textarea id="mensaje" name="mensaje" rows="10" cols="20" class="rounded" eform="Mensaje:string:1"></textarea>
              </p>
              <p>
              <input class="submit rounded" type="submit" name="submit" value="Enviar" />
              </p>
               </form>
              


              I get this HTML:

              
              
              
              <form method="post" action="http://mydomain.com/es/contacto">
              <p>
              <input type="hidden" name="formid"  value="contactForm" />
              <label for="nombre" >Nombre: </label>
              <input id="nombre" name="nombre" class="rounded" type="text" value="" />
              </p>
              <p>
              <label for="email" >E-mail: </label>
              <input id="email" name="email" class="rounded" type="text" value="" />
              </p>
               <p>
              
              <label for="asunto" >Asunto: </label>
              <input id="asunto" name="asunto" class="rounded" type="text" value="" />
              </p>
              <p>
              <label for="mensaje" >Mensaje: </label>
              <textarea id="mensaje" name="mensaje" rows="10" cols="20" class="rounded"></textarea>
              </p>
              <p>
              <input class="submit rounded" type="submit" name="submit" value="Enviar" />
              </p>
               </form>
              


              Should I try reinstalling the snippet? What I have is what came bundled with the MODx install. I just can’t think of anything else to try.
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                Interesting. I copy/pasted your form tpl, and your snippet call, and it worked just fine.
                [+validationMessage+]
                <form method="post" action="[(site_url)][~10~]">
                <p>
                <input type="hidden" name="formid" value="contactForm" />
                <label for="nombre">Nombre: </label>
                <input id="nombre" name="nombre" class="rounded" type="text" eform="Nombre::1" />
                </p>
                <p>
                <label for="email">E-mail: </label>
                <input id="email" name="email" class="rounded" type="text" eform="E-mail:email:1" />
                </p>
                 <p>
                <label for="asunto">Asunto: </label>
                <input id="asunto" name="asunto" class="rounded" type="text" eform="Asunto::1" />
                </p>
                <p>
                <label for="mensaje">Mensaje: </label>
                <textarea id="mensaje" name="mensaje" rows="10" cols="20" class="rounded" eform="Mensaje::1"></textarea>
                </p>
                <p>
                <input class="submit rounded" type="submit" name="submit" value="Enviar" />
                </p>
                 </form>

                [!eForm? &formid=`contactForm` &debug=`1` &to=`[email protected]` &subject=`bla` &tpl=`feedbackForm` &report=`feedbackReport`!]

                I didn’t actually have it go anywhere; but I did get the default thank-you message. I’ll set up my local install to send mail with my remote SMTP server and see if it works with the report and a real email address and everything.
                  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
                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  Try a re-install of the snippet in assets/snippets.
                    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
                    • 8772
                    • 13 Posts
                    See I knew the code was OK, I read the docs like 50 tiems. I even checked it out in the MODx book.

                    I hate these mystery problems that pop up when you least expect them.

                    By the way Susan, I’ve seen on your site that you know jQuery and do AJAX stuff. I have some problems in IE with some "hijax" stuff I’m doing on this very same site. If I send you an e-mail with my domain name and show you the problem, could I get a quote from you. I think I might need some help and I don’t mind paying someone as long as I know I can learn how they do it.
                      • 28042 ☆ A M B ☆
                      • 24,524 Posts
                      I wouldn’t be of much use for that; I don’t have access to IE 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