We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 41778
    • 6 Posts
    Hi guys,

    Once again I'm coming shouting for help...

    I am right now busy writing a contact form. For this purpose, I searched in the wiki, and online, and found Mary's tutorial to formit, which has been of a great help.

    But even with that one, I'm having an issue, and I can't figure out what's wrong in this code. Maybe you guys could help me out ?

    The form in itself is working, and is supposed to send information, but I receive this in my email :

    Bonjour ! [[+contact_name]] vient de vous envoyer un message à partir du formulaire de contact du site RomeoRecords. Ce message peut être très important. Merci de le considérer de la plus haute importance. Ceci n'est pas un spam. 
    [[+contact_message]]
    Vous pouvez répondre à [[+contact_name]] par mail à l'adresse [[+contact_email]] ou par téléphone au numéro [[+contact_phone_NA_format]].
    Merci de ne pas répondre à ce message. Il est généré automatiquement à partir du site web.


    As you can see, the placeholder are not replaced. Since it is sending an email let me think the issue is not inside Formit!, but somewhere else... I just can't find out...

    For easiness of reading, here is the code I'm using :

    This is the code of the SentEmailTpl. This code is placed inside a chunk and is called by the hook of Formit when the form is sent.

    Bonjour !
    
    [[+contact_name]] vient de vous envoyer un message à partir du formulaire de contact du site RomeoRecords. Ce message peut être très important. Merci de le considérer de la plus haute importance. Ceci n'est pas un spam.
     <br />
    <strong>[[+contact_message]]</strong><br />
    Vous pouvez répondre à [[+contact_name]] par mail à l'adresse <a href="mailto:[[+contact_email]]">[[+contact_email]]</a> ou par téléphone au numéro [[+contact_phone_NA_format]].<br>
    Merci de ne pas répondre à ce message. Il est généré automatiquement à partir du site web.


    And this is the code I'm using for the form in itself (I commented one line and replaced it with more basic functions, not truly paying attention to formatting right now. I would like it to work first before going any further inside Mary's tutorial on Formit :

    [[$header]]
        [[$latest_news]]
        <section id="content">
          <h2>Formulaire de contact</h2>
    	  [[*content]]
    [[!FormIt?
    &hooks=`email`
    &emailTpl=`sentEmailTpl`
    &emailSubject=`Message envoyé depuis votre site internet RomeoRecords.be`
    &emailTo=`[email protected]`
    ]]
    	  <form id="contactForm" action="[[~[[*id]]]]" method="post">
            <fieldset>
              <div class="field">
                <label>Votre nom:</label>
                <input type="text" value="[[!+fi.contact_name]]">
              </div>
              <div class="field">
                <label>Votre email:</label>
                <input type="email" value="[[!+fi.contact_email]]">
              </div>
              <div class="field">
                <label>Votre numéro de téléphone:</label>
                <input type="text" value="[[!+fi.contact_phone_NA_format]]">
              </div>
              <div class="field">
                <label>Votre message:</label>
               <textarea cols="70" rows="10"> [[!+fi.contact_message]]</textarea>
              </div>
    <input name="submit" class="button" type="submit" value="Envoyer">
    		  <!--<div class="button"><strong><span><a href="">Envoyer votre message !</a>
    		  </span></strong></div>-->
            </fieldset>
          </form>
        </section>
        <div class="clear"></div>
      </div>
    </div>
    [[$footer]]
    


    I checked all the code, and I can't figure out what is wrong. Since it is not working as it is supposed to be, I guess I'm missing something but I can't find out what is wrong.

    Could you guys help me out ?

    Thanks again
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Your form fields have to have a name attribute:

      <input type="text" name="contact_name" value="[[!+fi.contact_name]]">
        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
        • 41778
        • 6 Posts
        Yes sir ! You are totally right... How can I have missed that one. Thanks to you it is now working perfectly smiley

        Many thanks to you smiley