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

    I made a custom form to send e-mail, pretty basic but i can't get it to work. When i use the example (copy paste) found on the wiki the mail works. As soon as i'm dressing up the form (restyle the example, remove some fields etc) it stops working. Even when i strip the styling piece by piece: i cant get it to work.

    Can you figure it out? I'm dutch so some words are in dutch smiley The error checks work fine. When i fill the form and press submit it validates the fields but no mail sad I checked the .htaccess, the URL i use is the richts one (with www.)

    Chunck with FORM:
    [[!FormIt?
       &hooks=`recaptcha,spam,email,redirect`
       &emailTpl=`ContactTpl`
       &emailTo=`[email protected]`
       &emailSubject=`Bericht vanaf de website`
       &redirectTo=`2`
       &validate=`name:required,
          email:email:required,
          text:required:stripTags`
    ]]
    [[!+fi.error_message:notempty=`<p>[[!+fi.error_message]]</p>`]]
    <div id="mainForm">					
       <div id="formHeader">
          <p class="formInfo">Stuur ons een e-mail met uw vraag of opmerkingen. Velden met een asterisk (*) zijn verplicht.</p>
       </div><br/>
       <form action="[[~[[*id]]]]" method="post" class="form">
       <input type="hidden" name="nospam:blank" value="" />
    							
       <li class="mainForm">
          <label for="name">Naam en achternaam: *</label><br>
          <input type="text" name="name" id="name" value="[[!+fi.name]]" />
          <span class="error">[[!+fi.error.name]]</span>
       </li><br>
       <li class="mainForm">
          <label for="email">E-mailadres: *</label><br>     
          <input type="text" name="email" cols="55" id="email" value="[[!+fi.email]]" />
          <span class="error">[[!+fi.error.email]]</span>
        </li><br>
        <li class="mainForm">
           <label for="tel">Telefoonnummer:</label><br>
           <input type="text" name="tel" id="tel" value="[[!+fi.tel]]" />
           <span class="error">[[!+fi.error.tel]]</span>	
         </li><br>
         <li class="mainForm">
            <label>Onderwerp:[[+fi.error.subject]]</label><br>
            <select name="subject" value="[[!+fi.subject]]">
    	   <option value="one" [[!+fi.subject:FormItIsSelected=`one`]]>Vraag over het assortiment</option>
    	   <option value="two" [[!+fi.subject:FormItIsSelected=`two`]]>Website</option>
    	   <option value="three" [[!+fi.subject:FormItIsSelected=`three`]]>Algemene vraag</option>
    	   <option value="four" [[!+fi.subject:FormItIsSelected=`four`]]>Anders namelijk...</option>
          </select>
       </li><br>
       <li class="mainForm">
          <label for="text">Uw bericht:*</label><br>
          <textarea name="text" id="text" rows="10" value="[[!+fi.text]]">[[!+fi.text]]</textarea>
          <span class="error">[[!+fi.error.text]]</span>
        </li><br>						
           [[!+formit.recaptcha_html]]
           [[!+fi.error.recaptcha]]
           <li class="mainForm">
           <input id="saveForm" type="submit" value="Verstuur bericht" />
        </li><br>
       </form>
    </div>


    The e-mail template:
    Het volgende bericht is door :  [[+name]] ([[+email]]) verzonden vanaf het contactformulier:
    <br/>
    [[+text]]
    
    <br /><br />
    Optionele velden: <br />
    Telefoon: [[+tel]] <br/>
    Onderwerp: [[+subject]]


    The CSS used for the styling:
    #mainForm {border: solid #D8DBD2 1px;text-align:left;width:320px;float:right;position:relative;margin-top:7px;font-size: 11px;}
    #saveForm, input[type=text], select[name=numbers], textarea[name=text] {width:291px;}
    #mainForm label {font-weight:bold;}
    #mainForm img {border:0px;}
    #mainForm li, #mainForm ul {list-style-type:none;font-size:12px;}
    #formHeader {position:relative;width:100%;background-color: #5B5B5B;margin: 0 0 0 0;padding-bottom: 10px;}
    #formInfo {position:relative;width:100%;margin: 0 0 0 0;}
    p.formInfo {text-align:left;margin: 0 0 0 0;color: #000000;position:relative;left: 10px;top: 0px;color:#D8DBD2;}


    Remember, i did got the form working, re-used the code.

    Gr,

    Erwin
      • 1778
      • 659 Posts
      Hi,
      did you try too add &submitVar=`saveForm` in your formit call and add name="saveForm" in the submit link of your form ?
      Cheers
        • 35545
        • 35 Posts
        Quote from: anso at Jan 06, 2012, 06:31 AM
        Hi,
        did you try too add &submitVar=`saveForm` in your formit call and add name="saveForm" in the submit link of your form ?
        Cheers

        Didn't work sad

          • 35545
          • 35 Posts
          Someone?? [ed. note: MrReaL last edited this post 14 years, 9 months ago.]
            • 1841
            • 141 Posts
            I can't get form it to work either, anyone have an idea of how to use this?
              • 1841
              • 141 Posts
              I installed Formit, copied and pasted the example call and form and couldn't get it to work at all, tried removing the captcha code and still no joy.

              I then tried a very simple call and form with just name, email and message without any requirements and still couldn't get it to work.

              Has anyone got any experience using this Extra?
                • 35545
                • 35 Posts
                Well, i got it working. This has been one of many stupid little things that made my introduction to ModX very hard. But bottomline, ModX rocks and is very easy... however, the documentation sucks big time. Al the documentation has been made from a developer point of view.

                Most of my problems find origin within common knowledge. for instance: recaptcha... i really had no clue this was a Google service! How should i know? My mistake was simple, i do not have to use captcha but did not know that i needed a specific key from a specific location: removing `recaptcha` from &hooks=`recaptcha,spam,email,redirect` did the trick. Form works perfect. no way this is stated clearly on the wiki.

                Good documentation however shlould have explained some basics. Also the use of &hooks=`bla,bla,bla` lacks a good explenation.

                Conclusion: ModX has been made for flexibility/possibility's, as i see it also for people with no programming background. Therefor documentation should get much more attention so people can get around better. The ModX system rocks totally, Joomla has never ever crossed my mind for a second since i start using ModX.