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

    my form is sent twice, and i cannot see how smiley
    does someone had the same problem ?

    here is my code (i call the form uncached in my ressource) :

    Form :

    [[!FormIt?
       &hooks=`email,FormItAutoResponder`
       &emailFrom=`[[+email]]`
       &emailTpl=`form-contact-envoi`
       &emailTo=`[[+addressTo]]`
       &emailSubject=`Demande depuis le site internet`
       &fiarTpl=`form-contact-fiar`
       &fiarSubject=`subject`
       &fiarReplyTo=`[[+email]]`
       &fiarFrom=`[email protected]`
       &fiarFromName=`Test`
       &validate=`workemail:blank, addressTo:required, email:email:required, adresse:required, name:required, npa:required, comment:required`
       &successMessage=`
          <h3>Votre demande nous a bien été envoyée.</h3>
        `
       &successMessagePlaceholder=`fi.successMessage1`
    ]]
    [[!+fi.error_message:notempty=`<p>[[!+fi.error_message]]</p>`]]
    [[!+fi.successMessage1]]
        <form action="[[~[[*id]]]]" method="post"  name="formcontact" id="formcontact">
        <input type="hidden" name="workemail" value="" id="workemail1" />
    
    <fieldset>
    
    
    <label for="addressTo">Choix du département<span class="requis">*</span><span class="requis">[[!+fi.error.addressTo]]</span></label>
    
    <select name="addressTo">
       <option value="" >Choisir le destinataire</option>
       <option value="[email protected]" [[!+fi.addressTo:FormItIsSelected=`[email protected]`]]>info</option>
       <option value="[email protected]" [[!+fi.addressTo:FormItIsSelected=`[email protected]`]]>test</option>
    </select>
    
    			<label for="societe">Société</label>
    			<input type="text" name="societe" value="[[!+fi.societe]]" id="societe">
    
    			<label for="titre">Titre</label>
    
    			<select name="titre">
    			<option value="" >Votre titre</option>
      			<option value="Madame" [[!+fi.titre:FormItIsSelected=`Madame`]]>Madame</option>
       			<option value="Monsieur" [[!+fi.titre:FormItIsSelected=`Monsieur`]]>Monsieur</option>
    			</select>
    
                <label for="nom">Nom & Prénom<span class="requis">*</span><span class="requis">[[!+fi.error.name]]</span></label>
    			<input type="text" name="name" value="[[!+fi.name]]"  id="name">
    
    			<label for="adresse">Adresse<span class="requis">*</span><span class="requis">[[!+fi.error.adresse]]</span></label>
    			<input type="text" name="adresse" value="[[!+fi.adresse]]" id="adresse">
    
    			<label for="npa">NPA & Localité<span class="requis">*</span><span class="requis">[[!+fi.error.npa]]</span></label>
    			<input type="text" name="npa" value="[[!+fi.npa]]"  id="npa">
    
    			<label for="telephone">Téléphone</label>
    			<input type="text" name="telephone" value="[[!+fi.telephone]]"  id="telephone">
    
    			<label for="fax">Fax</label>
    			<input type="text" name="fax" value="[[!+fi.fax]]"  id="fax">
    
                <label for="email">Email<span class="requis">*</span><span class="requis">[[!+fi.error.email]]</span></label>
    			<input type="text" name="email" value="[[!+fi.email]]" id="email">
    
    			<label for="fax">Site internet</label>
    			<input type="text" name="site" value="[[!+fi.site]]"  id="site">
    
    
                <label for="comment">Commentaire<span class="requis">*</span><span class="requis">[[!+fi.error.comment]]</span></label>
    			<textarea name="comment" cols="30" rows="10" value="[[!+fi.comment]]" id="comment"></textarea>
    			
    
            <input  type="submit" value="Envoyer" class="button">
    </fieldset>
     
        </form>
         



    and e-mail tpl :

    Société : [[+societe]]<br />
    Titre : [[+titre]]<br />
    Nom & Prénom : [[+name]]<br />
    Adresse: [[+adresse]]<br />
    NPA & localité : [[+npa]]<br />
    Téléphone : [[+telephone]]<br />
    Fax : [[+fax]]<br />
    
    E-mail : [[+email]]<br />
    Site web : [[+site]]<br />
    Demande : [[+comment]]<br />


    thanks for your help !
      • 36613
      • 328 Posts
      Twice to same email ?
        • 30672
        • 180 Posts
        Yes twice the same!
          • 47532
          • 2 Posts
          I'm having the same issue. Did you ever find a solution troubadour?
            • 30672
            • 180 Posts
            yeah, i found a sh...y solution...
            the problem happened when calling the chunk-form in a ressource.
            i simply createad a new model directly including the form, and now it is working.

            i don't really understand why it happens because i have other modx running exacty the same without problem...

            what is special here is the function &emailTo=`[[+addressTo]]` for selectionning the recipient. Maybe this is the cause the problem ? Do you use this ?
              • 47532
              • 2 Posts
              Thanks for the suggestions troubadour.

              The example I followed to create the form was from CSS Tricks (http://www.cmstricks.com/blog/2013/03/21/modx-form-submission-with-formit/). What I eventually discovered was that having the success message on the same page was causing duplicate submissions. To remedy this I created a Thank You page using the FormIt.FormItRetriever snippet.

              I did not use the &emailTo=`[[+addressTo]]`, but may try in the future.
                • 30672
                • 180 Posts
                it might be the thank you message on the same page... but causing no problem on other modx website, on the same shared webserver.... smiley