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

    I seem to be having some issues implementing the FormIt-snippet, mostly due to very incomplete documentation.

    I have a form as following:

    [[FormIt?emailTo=`[email protected]`&emailToName=`Steven Langbroek`&emailHTML=`false`&redirectTo=`8`&emailTpl=`contactEmailTpl`&emailSubject=`Contactformulier ingevuld`]]
    <form>
    	<fieldset>
    		<div><label class="title">naam</label><input type="text" class="normal" name="name:required" value="[[+fi.name]]" /></div>
    		<div><label class="title">e-mail</label><input type="text" class="normal" name="email:required" value="[[+fi.email]]" /></div>
    		<div><label class="title">telefoon</label><input type="text" class="normal" name="phone" value="[[+fi.phone]]" /></div>
    		<div><label class="title">bericht</label><textarea name="bericht:required:stripTags" class="normal" rows="4" cols="20">[[+fi.message]]</textarea></div>
    		<div><label class="title"> </label><input type="submit" id="submit" value="verzenden" /></div>
    	</fieldset>
    </form>
    


    I can’t find:

    - Where to put my Snippet-call (inside the form, outside of the form?)
    - What to put in the <form>-call as action or method

    Can anyone help me out? I’ll add it to the documentation when all of this is sorted out.
      • 1778
      • 659 Posts
      Hello,

      where to put your snippet : in the resource where is your form.( as in the contact page example).

      You call your snippet (on the top of the resource for example):
      [[!FormIt?
          &hooks=`spam,email,redirect`
          &emailTpl=`phronEmailTpl`
          &emailTo=`your [email protected]`
          &redirectTo=`123`
      ]]
      


      below the call of the snippet you put your form code like this
      <form action="[[~[[*id]]]]" method="post" class="form" id="contactform">
      
      // code of your form comes here //
      
      </form>
      

      in this case "action" is the ID of the current resource (ie the resource where are your form and your snippet call)

      the method is "post" (to post filled in data to server and process the validators and hooks) ...

      Hope this helps,
      Cheers


        • 28554
        • 201 Posts
        Wow thanks! That was rly helpful (and quite logical now that I think about it)! Only thing that doesn’t seem to be working is replacing the placeholders with actual form-data in the e-mail that’s been triggered. My template is:

        Chunk: contactEmailTpl
        <p>Bericht van: [[+fi.name]] ( [[+fi.email]] )<br />
        Telefoonnummer: [[+fi.phone]]</p>
        <p>Bericht:<br />
        [[+fi.message]]</p>
        


        D’ya think you could help me out 1 more time? Thanks laugh
          • 1778
          • 659 Posts
          Hello again,

          happy to be helpful smiley

          your emailTpl should contain only the placeholders with the "name" of the field like this :

          <p>Bericht van: [[+name]] ( [[+email]] )<br />
          Telefoonnummer: [[+phone]]</p>
          <p>Bericht:<br />
          [[+message]]</p>
          


          I assume your fields in the form are something like

          <input type="text" name="name" id="name" value="[[+fi.name]]" />
          <input type="text" name="phone" id="phone" value="[[+fi.phone]]" />
          <textarea name="message" id="message" rows=5 cols=50 />[[+fi.message]]</textarea>
          


          You can put like this all the placeholders you need...

          Cheers
          Enjoy with FormIt
            • 28554
            • 201 Posts
            That’s absolutely fabulous! Up and running on my staging-server at www.digitaaldier.nl/dev/youridentity/index.php?id=4 smiley drop me a line laugh
              • 1778
              • 659 Posts
              done. You have a message from anso
              Cheers
                • 28554
                • 201 Posts
                Haha got it smiley thanks m8!