We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30223
    • 1,010 Posts
    Here’s another improvement of eForm, but before I’m dumping it in the reporitory I’d like some testers!

    I’ve still got a few things to do before it’s final but that’s mostly todo with the documentation so bear with me...

    Oh yes, It’s BETA, don’t use it in production sites just yet!

    Here’s what’s changed:

    • Fixed: &debug parameter wasn’t doing anything
    • Fixed: Returning ’foreach’ error when chunk or document not found for form template
    • Fixed: Erroneous error when using multiple forms on a page ($formats persisted between eForm calls)
    • Updated: Events now work using the &eFormOnBeforeMailSent and &eFormOnMailSent paramaters.
      The previous event structure did not appear to work without some tricks (variables were out of scope)
    • Updated: [+subject+] can now be used in report and thank you templates
    • Updated: When using a document for the templates the document no longer needs to have published set
    • New: Show error if &tpl is set to the same document (id) containing the eForm snippet call
    • New: extended debug messages for validated fields (if &debug is set)
    • New: added some protection against mail injection (still to do -
      send ’abuse alert’ mail to [(mailsender)] (controlled by a configuration parameter)

    • New: You can now use <form id="formName"...> to match your &formid=`formName`
      instead of <input type="hidden" name="formid" value="formName" />
    • New: You can now set the description using the label tag instead of in the eform attribute
      eg. <label for="email">Your Email</label><input type="text" name="email" eform=":email:1::/>
      instead of <label>Your Email</label><input type="text" name="email" eform="Your Email:email:1::/>
      If both are used the eform value takes precedence.
    • New: Added &disclaimer parameter for adding a disclaimer to the email body. Can be chunk name or document id
      Need to manually add [+disclaimer+] placeholder to report template
    • Optimized: moved form parser code so it is only executed when form is posted
    • Updated: You can again use placeholders in &from and &fromname (as you can with &subject and &keywords)
    • Updated: It is now possible to use special placeholders in #SELECT validation rule i.e.
      #SELECT jobnum FROM translation_jobs WHERE client_email={email}
    • New: you can now use the #LIST validation rule for file type checking with file uploads
      by supplying a list of file extensions eg: #LIST jpg,jpeg,png,gif

    • New Examples:
      [list]
      [li]Multiple forms on one page

    • How to use eform events
    [/li]
    [/list]

    EDIT: updated eform.snippet.tpl in teh zip file. For some reason all ? & were stripped in the original.

    Edit 13 October 2006:

    Some fixes and 1 new addition.
    Make sure to replace the snippet with the content from eform.snippet.tpl as well.

    # New: Extra parameters &sendAsHtml and &sendAsText - force email messages to be in Html
    # or text only format. Possible values:
    # &sendAsHTML=`1`- send all messages as html
    # &sendAsHTML=`[report],[autotext],[mobile]`- send specified messages as html
    # &sendAsText=`1`- send all messages as text only
    # &sendAsText=`[report],[autotext],[mobile]`- send specified messages as text only
    # Fixed: eform attribute not stripped when form is displayed first time
    # Fixed: Error getting templates from document id when this document is published
    # Fixed: Stupid copy/paste errors in snippet call
    # Fixed: placeholders not getting replaced in the report

    EDIT - Version 1.4 has now been added to the repository

    To download eForm and for an updated list of all changes see the repository

      • 28042 ☆ A M B ☆
      • 24,524 Posts
      I am beginning to see the logic of a new user registration/login/profile editing system based on this. As well as shopping checkout where the whole final checkout process passes through eForm, with the payment validation occurring in the eFormOnBeforeMailSent event and different mail being sent depending on what that validation function returns. Nice!
        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
        • 25663 MODX Staff
        • 12,272 Posts
        Sounds good, but did anything change? tongue

        Great work Jelle. Make that really great work after having read through the documentation and examples... wow! laugh I’m really looking forward to seeing an eForm recipe book at http://wiki.modxcms.com/.

        Quick question: could the mobile mail be "creatively used" for text-only reports (and if so, should it be re-labelled)?
          Ryan Thrash, MODX Co-Founder
          Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
          • 30223
          • 1,010 Posts
          Quote from: rthrash at Oct 11, 2006, 01:51 AM

          Quick question: could the mobile mail be "creatively used" for text-only reports (and if so, should it be re-labelled)?

          To be honest &mobiletext is a &parameter I haven’t realy looked at. It was there from the beginning but yes you’re right that’s basically what it does, send text only emails and perhaps re-labeling would make that clearer. Any suggestions?
            • 25663 MODX Staff
            • 12,272 Posts
            "&textReport" maybe?
              Ryan Thrash, MODX Co-Founder
              Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
              • 30223
              • 1,010 Posts
              &textReport sounds good as a replacement for &mobiletext. How about &notify for &mobile, because that’s basically what it was meant for I think, to alert someone about the form being used.
                • 25663 MODX Staff
                • 12,272 Posts
                I can go with that.
                  Ryan Thrash, MODX Co-Founder
                  Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                  • 32963
                  • 1,732 Posts
                  Firstly, great additions Jelle. very nice work.

                  Adding a &notify option would be great but I think it’s best to leave the option to send special text to mobile devices. The &notify option can be used to send either text and/or html notices to a user. By default noticies can be sent as text but the user could change this to something like &sendAsHtml=`notify`

                  by setting &sendAsText=`1` the system will send out all emails as text
                  by setting &sendAsHtml=`1` the system will send out all emails as html
                  by setting &sendAsHtml=`report,notify,...` the system will send those templates as html.




                    xWisdom
                    www.xwisdomhtml.com
                    The fear of the Lord is the beginning of wisdom:
                    MODx Co-Founder - Create and do more with less.
                    • 30223
                    • 1,010 Posts
                    It was more meant as a clarification in parameter names and not a change in functionality. What it basically would still do is sent out a ’short’ text only message as set by &mobiletext (&textReport) to the special address &mobile (&notify). If that special address leads to a mobile device or not already makes no difference does it? I think I’ll leave the naming as is for the moment and maybe clarify the potential different usage in an example.

                    sendAsText and sendAsHtml sounds like a usefull addition. I’ll see if I can find some moments to slot that in.
                      • 4707
                      • 73 Posts
                      there are errors in file eform.snippet.tpl, lines 57-60:
                      reportAbuse = isset($reportAbuse)? $reportAbuse:0,
                      eFormOnBeforeMailSent = isset($eFormOnBeforeMailSent)?$eFormOnBeforeMailSent:’’,
                      eFormOnMailSent = isset($eFormOnMailSent)?$eFormOnMailSent:’’,
                      disclaimer = isset($disclaimer)?$disclaimer:’’

                      it should be:
                      reportAbuse => isset($reportAbuse)? $reportAbuse:0,
                      eFormOnBeforeMailSent => isset($eFormOnBeforeMailSent)?$eFormOnBeforeMailSent:’’,
                      eFormOnMailSent => isset($eFormOnMailSent)?$eFormOnMailSent:’’,
                      disclaimer => isset($disclaimer)?$disclaimer:’’