We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28042 ☆ A M B ☆
    • 24,524 Posts
    I’m having trouble finding documentation on using this event; what parameters does the function require, and how would one go about using Ditto to populate the dynamically added form fields? I’m not afraid of trial-and-error, but I could use a place to start.

    As far as I can see from the eform core, it would only take the one parameter, &$fields, so I think the Ditto template would need to output something like "$fields[] = [+whatever+] etc", the trial-and-error part comes in here to find out what would work!
      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
      • 30223
      • 1,010 Posts
      Totally missed this post before....

      It depends on what you want to do but if you want to dynamically populate the form the eFormOnBeforeParse event would be a better event as otherwise eForm would be unaware of the added form fields when it processes the form. eFormOnBeforeParse takes to parameters, &$fields and &$templates of which $templates[’tpl’] would be of most interest (but you probably know this already)

      How you would go about getting Ditto output in to the event function I’m not sure. I don’t know Ditto all that well. Presumably by calling Ditto from within the eform event function and replacing/adding to the &$templates[’tpl’] variable.
        • 7455
        • 2,204 Posts
        I used ditto to populate a pulldown list once:

        http://modxcms.com/forums/index.php/topic,12770.msg102365.html#msg102365

        works great

        Dimmy
          follow me on twitter: @dimmy01
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Thanks! Looks like exactly what I need! In this case, it’s a catalog, and each item will have a checkbox. The order form gets emailed, along with customer’s contact information. Customer is contacted, no online payment gateway.
            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