We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7455
    • 2,204 Posts
    It works like a charm Thanks a lot
    made this form wth it:
    http://www.aladna.nl/index.php?id=7

    all i need to do now is creating / changing the language for the error and the thank you.

    Nice work thanks
      follow me on twitter: @dimmy01
      • 25663 MODX Staff
      • 12,272 Posts
      Hey Dimmy, can you give us a quick run-through as to the calls and how you built that form, and what happens on submit? Thanks!
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 7455
        • 2,204 Posts
        ok here it comes:

        this is my form a chuck called myform:

        <span style='color:red'>[+validationmessage+]</span>
        <form method="post" enctype="multipart/form-data">
        <input name="formid" type="hidden" value="MyForm"/>
        
        <table width="316" border="0" cellspacing="2" cellpadding="0">
        <tr>
        <td colspan="4">
        <h3>Gegevens aanvrager</h3>
        </td>
        </tr>
        <tr>
        <td colspan="2">Bedrijf*</td>
        <td colspan="2"><input type="text" name="bedrijf" value="[+bedrijf+]" size="31"></td>
        </tr>
        <tr>
        <td colspan="2">Contactpersoon*</td>
        <td colspan="2"><input type="text" name="contact" value="[+contact+]" size="31"></td>
        </tr>
        <tr>
        <td colspan="2">E-Mail*</td>
        <td colspan="2"><input type="text" name="email" value="[+email+]" size="31"></td>
        </tr>
        <tr>
        <td colspan="2">Website http://</td>
        <td colspan="2"><input type="text" name="website" value="[+website+]" size="31"></td>
        </tr>
        <tr>
        <td colspan="2">Telefoonnummer</td>
        <td colspan="2"><input type="text" name="telefoon" value="[+telefoon+]" size="31"></td>
        </tr>
        <tr>
        <td colspan="2">Faxnummer</td>
        <td colspan="2"><input type="text" name="fax" value="[+fax+]" size="31"></td>
        </tr>
        <tr>
        <td colspan="2">Adres</td>
        <td colspan="2"><input type="text" name="adres" value="[+adres+]" size="31"></td>
        </tr>
        <tr>
        <td colspan="2">Postcode / Plaats</td>
        <td><input type="text" name="postcode" value="[+postcode+]" size="8" maxlength="6"></td>
        <td><input type="text" name="plaats" value="[+plaats+]" size="15"></td>
        </tr>
        <tr>
        <td colspan="4">
        <address>*verplicht invulveld</address>
        </td>
        <tr height="19">
        <td height="19"></td>
        <td height="19"></td>
        <td height="19"></td>
        <td height="19"></td>
        </tr>
        <tr>
        <td colspan="3">Hoe heeft u ons gevonden?</td>
        <td><select name="gevonden" size="1">
        <option selected value="Niets geselecteerd">Selecteer</option>
        <option value="Telefoongids">Telefoongids</option>
        <option value="goudengids">Gouden Gids</option>
        <option value="internet">Internet</option>
        <option value="anders">Anders</option>
        </select></td>
        </tr>
        <tr>
        <td></td>
        <td></td>
        <td>Anders:</td>
        <td><input type="text" name="anders" value="[+anders+]" size="15"></td>
        </tr>
        <tr height="19">
        <td height="19"></td>
        <td height="19"></td>
        <td height="19"></td>
        <td height="19"></td>
        </tr>
        <tr>
        <td colspan="4">
        <h3>Gegevens vertaal opdracht</h3>
        </td>
        </tr>
        <tr>
        <td colspan="2">Omvang</td>
        <td colspan="2"><input type="text" name="omvang" value="[+omvang+]" size="31"></td>
        </tr>
        <tr>
        <td colspan="2">Onderwerp</td>
        <td colspan="2"><input type="text" name="onderwerp" value="[+onderwerp+]" size="31"></td>
        </tr>
        <tr>
        <td colspan="2">Brontaal*</td>
        <td colspan="2"><input type="text" name="brontaal" value="[+brontaal+]" size="31"></td>
        </tr>
        <tr>
        <td colspan="2">Doeltaal*</td>
        <td colspan="2"><input type="text" name="doeltaal" value="[+doeltaal+]" size="31"></td>
        </tr>
        <tr>
        <td colspan="2">Levertermijn</td>
        <td colspan="2"><input type="text" name="levertermijn" value="[+levertermijn+]" size="31"></td>
        </tr>
        <tr>
        <td colspan="4">
        <address>*verplicht invulveld</address>
        </td>
        </tr>
        <tr height="19">
        <td height="19"></td>
        <td height="19"></td>
        <td height="19"></td>
        <td height="19"></td>
        </tr>
        <tr>
        <td colspan="4">
        <h3>Opmerkingen</h3>
        </td>
        </tr>
        <tr>
        <td colspan="4"><textarea name="opmerkingen" rows="4" cols="40">[+opmerkingen+]</textarea></td>
        </tr>
        <tr height="19">
        <td height="19"></td>
        <td height="19"></td>
        <td height="19"></td>
        <td height="19"></td>
        </tr>
        <tr>
        <td colspan="4">Voeg hier tekst(en) bij (.txt, .doc, .pdf, .rtf)</td>
        </tr>
        <tr>
        <td colspan="2">Bestand 1</td>
        <td colspan="2"><input type="file" name="file1" size="16"></td>
        </tr>
        <tr>
        <td colspan="2">Bestand 2</td>
        <td colspan="2"><input type="file" name="file2" size="16"></td>
        </tr>
        <tr>
        <td colspan="2">Bestand 3</td>
        <td colspan="2"><input type="file" name="file3" size="16"></td>
        </tr>
        <tr height="19">
        <td height="19"></td>
        <td height="19"></td>
        <td height="19"></td>
        <td height="19"></td>
        </tr>
        <tr>
        <td colspan="2">
        <div align="left">
        <input type="submit" name="Verzenden" value="Verzenden"></div>
        </td>
        <td></td>
        <td>
        <div align="right">
        <input type="reset" value="Wissen"></div>
        </td>
        </tr>
        </table>
        </form>
        


        the i got chuck thats a template for formatting the mail called myreport:
        	
        [+file1+]
        [+file2+]
        [+file3+]	
        <table width="316" border="0" cellspacing="2" cellpadding="0">
        <tr>
        <td colspan="4">
        <h3>Gegevens aanvrager</h3>
        </td>
        </tr>
        <tr>
        <td colspan="2">Bedrijf</td>
        <td colspan="2">[+bedrijf+]</td>
        </tr>
        <tr>
        <td colspan="2">Contactpersoon</td>
        <td colspan="2">[+contact+]</td>
        </tr>
        <tr>
        <td colspan="2">E-Mail</td>
        <td colspan="2">[+email+]</td>
        </tr>
        <tr>
        <td colspan="2">Website http://</td>
        <td colspan="2">[+website+]</td>
        </tr>
        <tr>
        <td colspan="2">Telefoonnummer</td>
        <td colspan="2">[+telefoon+]</td>
        </tr>
        <tr>
        <td colspan="2">Faxnummer</td>
        <td colspan="2">[+fax+]</td>
        </tr>
        <tr>
        <td colspan="2">Adres</td>
        <td colspan="2">[+fax+]</td>
        </tr>
        <tr>
        <td colspan="2">Postcode / Plaats</td>
        <td>[+postcode+]/</td>
        <td>[+plaats+]</td>
        </tr>
        <tr>
        <td colspan="4">
        </td>
        </tr>
        <tr height="19">
        <td height="19"></td>
        <td height="19"></td>
        <td height="19"></td>
        <td height="19"></td>
        </tr>
        <tr>
        <td colspan="3">Hoe heeft u ons gevonden?</td>
        <td>[+gevonden+]</td>
        </tr>
        <tr>
        <td></td>
        <td></td>
        <td>Anders:</td>
        <td>[+anders+]</td>
        </tr>
        <tr height="19">
        <td height="19"></td>
        <td height="19"></td>
        <td height="19"></td>
        <td height="19"></td>
        </tr>
        <tr>
        <td colspan="4">
        <h3>Gegevens vertaal opdracht</h3>
        </td>
        </tr>
        <tr>
        <td colspan="2">Omvang</td>
        <td colspan="2">[+omvang+]</td>
        </tr>
        <tr>
        <td colspan="2">Onderwerp</td>
        <td colspan="2">[+onderwerp+]</td>
        </tr>
        <tr>
        <td colspan="2">Brontaal*</td>
        td colspan="2">[+brontaal+]</td>
        </tr>
        <tr>
        <td colspan="2">Doeltaal*</td>
        <td colspan="2">[+doeltaal+]</td>
        </tr>
        <tr>
        <td colspan="2">Levertermijn</td>
        <td colspan="2">[+levertermijn+]</td>
        </tr>
        <tr height="19">
        <td height="19"></td>
        <td height="19"></td>
        <td height="19"></td>
        <td height="19"></td>
        </tr>
        <tr>
        <td colspan="4">
        <h3>Opmerkingen</h3>
        </td>
        </tr>
        <tr>
        <td colspan="4">[+opmerkingen+]</td>
        </tr>
        <tr height="19">
        <td height="19"></td>
        <td height="19"></td>
        <td height="19"></td>
        <td height="19"></td>
        </tr>
        </table>
        


        and this is the snippet call:
        [[eForm?&formid=`MyForm` &tpl=`myform` &report=`myreport` &to=`[email protected]` &format=`bedrijf:Bedrijf:string:1,contact:Contactpersoon:string:1,
        email:Email:email:1,brontaal:Brontaal:string:1,doeltaal:Doeltaal:string:1,
        file1:Bestand 1:file:0,file2:Bestand 2:file:0,file3:Bestand 3:file:0`
        &subject=`Vertaalopdracht van [+contact+] van [+bedrijf+]` ]]
        


        snippetcall easyer to read:
        [[eForm? //snippet name...
        
        &formid=`MyForm` //formname see this line in the myform chunk "<input name="formid" type="hidden" value="MyForm"/>"
        
        &tpl=`myform` //template name of the chunk that holds the form in my case the chunk is called myform not to confuse with the form id MyForm.
        
        &report=`myreport` //this is the chuck that contains the mail template as you see above. 
        
        &to=`[email protected]` //mail adres...
        
        &format=` //this part does the verivication and tels the class what to do with it.
        
        bedrijf:Bedrijf:string:1, //"bedrijf" = input name, "Bedrijf" is what the class will say when this input is not filled in e.g. [color=red]Bedrijf is required [/color], "string" is to tell the class what kind of input he is dealing with, the 1 means that the class needs to validate the input (0 will not be validated) 
        
        contact:Contactpersoon:string:1,
        email:Email:email:1,
        brontaal:Brontaal:string:1,
        doeltaal:Doeltaal:string:1,
        
        file1:Bestand 1:file:0, //for the class to mail the files they need to be in here the 0 indicates that its not a requierd field, instead of "string" I used "file" for the class to know its a file to be atached.
        
        file2:Bestand 2:file:0,
        file3:Bestand 3:file:0`
        
        &subject=`Vertaalopdracht van [+contact+] van [+bedrijf+]` //This sets the Subject and uses 2 inputs with it. (in the explenation in the first treat it says to use [.placeholder.] that did not work for me [+placeholder+] did the trick)
        only inputs that you want to be requierd and files are needed to be in the snippetcall the rest of the fields wil be picked up by the class en put in the mailtemplate ("myreport")
        
        ]]
        


        I hope its understandible this way.
        Try it make sure you use the latest PHPmailerClass or file upload will not work.

        [edit] this overflow:hidden or somthing like this on the code space is nasty... had to reformat the thing to make all text visible with snippetcals this long it wil never break to a next line... [/edit]
        Greets Dimmy
          follow me on twitter: @dimmy01
          • 7455
          • 2,204 Posts
          is it posible to use the email in the form as the sender of the mail?
          that way it is easy to reply to a mail, I tryed [+email+] but that did not work.
            follow me on twitter: @dimmy01
            • 32963
            • 1,732 Posts
            This version does not supoort such a feature but the snippet can be modified to include a reply-to header inside the mail.
              xWisdom
              www.xwisdomhtml.com
              The fear of the Lord is the beginning of wisdom:
              MODx Co-Founder - Create and do more with less.
              • 7455
              • 2,204 Posts
              Quote from: xwisdom at Jan 22, 2006, 10:27 AM

              This version does not supoort such a feature but the snippet can be modified to include a reply-to header inside the mail.

              That would be nice
              and the error messages that say requierd or thank you...
              could those be translated somwhere or in the snippetcall or template?
                follow me on twitter: @dimmy01
                • 32963
                • 1,732 Posts
                You can use a thank you page
                  xWisdom
                  www.xwisdomhtml.com
                  The fear of the Lord is the beginning of wisdom:
                  MODx Co-Founder - Create and do more with less.
                  • 32241
                  • 1,495 Posts
                  I guess it’s time for me to get back to susan’s documentation link for prototype. I’ll try to work on this Raymond. So you don’t have to worry too much on the second tier system. smiley We will work as best as we could on own tier. Hope this can inspired the next snippet coder to start standardizing everything. smiley
                    Wendy Novianto
                    [font=Verdana]PT DJAMOER Technology Media
                    [font=Verdana]Xituz Media
                    • 32847
                    • 171 Posts
                    I exactly copy paste instruction from dimmy but I have got

                    "Invalid Form Id number or name."

                    Do you have any explain?
                    Thanks

                    [Solved]
                    oups, I forgotten a space bettew ? and &
                    eForm?&formid=`MyForm`

                      • 7455
                      • 2,204 Posts
                      ok nice work then.

                      Dimmy
                        follow me on twitter: @dimmy01

                      This discussion is closed to further replies. Keep calm and carry on.