We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28215
    • 4,149 Posts
    Quote from: Dimmy at Oct 20, 2009, 09:29 AM

    Well when do the hooks activate?
    In the order that they are put in.


    like in eform I can say just before the mail is send out I can alter the output so I can add stuff to it maybe a time stamp or whatever I like or put the fields in the database etc etc. (http://wiki.modxcms.com/index.php/EForm#Events)
    So just add a hook before as a custom snippet. Example, here with custom snippet named ’addMyEvents’:

    [[!FormIt? &hooks=`addMyEvents,email,redirect`]]

    Would call the addMyEvents hook first, then the email hook.

    report is the chunk that is used to create the mail that is send out
    using the names of the fields as placeholders, that way you can make a nice html email or at least order the values from the fields in a way you like.
    That’s in there - &emailTpl.

    eform also hase a chunk that can be used to send out to the one filling the form it will be differnd from the report chunk (the mail that is send to the owner of the site )
    That could be another hook; you could add a hook that does just that. And then add some custom properties to pass in to that hook, etc.

    did you use eForm before? look at what eform can do and make formit at least have the same options.
    I disagree; eForm was bloated and did bad practices; I’m trying to make FormIt leaner and more flexible.
      shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
      • 7455
      • 2,204 Posts
      ok I understand now the mail and the validate are 2 hooks that are always in the code to use and by altering the sequense (read add your own in between or after / before) will trigger that hook at that time?

      the form is just placed below the call? so no need for a seperate parameter in the call? like eform has? (&tpl=`chunkwithform`)

      that is beter
      so I could generate a form using any snippet and have formit validate the form?

      I think I just have to play with it and see if I can do all I like with it.

      Thanks again


        follow me on twitter: @dimmy01
        • 28215
        • 4,149 Posts
        Quote from: Dimmy at Oct 20, 2009, 10:03 AM

        ok I understand now the mail and the validate are 2 hooks that are always in the code to use and by altering the sequense (read add your own in between or after / before) will trigger that hook at that time?
        Yes. And a hook can be a custom snippet.

        the form is just placed below the call? so no need for a seperate parameter in the call? like eform has? (&tpl=`chunkwithform`)
        No. The FormIt call is placed in the Resource.

        so I could generate a form using any snippet and have formit validate the form?
        Yes. And you can also have it only trigger if a POST var is found, using &submitVar - this is useful if you want to have more than one form on a page.

        I think I just have to play with it and see if I can do all I like with it.
        I would recommend reading the docs:
        http://svn.modxcms.com/docs/display/ADDON/FormIt
          shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com