We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 13736
    • 345 Posts
    I have a multi field search form that is configured to send data to an external processor (quote generator). I would like to set it up to use the MODx 2 form processor so that I can store each submission in a history accessible for each user as well as an administrator. However, I’m not sure the best way to do this. Can FORM markup send to multiple locations or is there a way to set the MODx form processor to "bounce" the data to the next url?

    Second, I’m not exactly sure how to store each submission and redisplay it only for each user.

    Third, an Admin user -- who can see all users with the Peoples snippet -- needs to be able to link to each users submission history.

    I think currently this is over my MODx 2 experience level. Anyone have any suggestions?
      • 3749
      • 24,544 Posts
      The FormIt snippet will store the form results and you can do what you want with them in a postHook.
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 22019
        • 390 Posts
        As I understand your requirement, you will need to:

        * create a custom table to store the searches
        * create a MODx object to model the custom table (Bruno17 has a snippet that does this on the Forum somewhere)
        * use the FormIt package with at least two hooks - one to call a snippet to instantiate the object and save it with the data from the form, and another to redirect to the processor URL. You could also daisy chain variables using sessions or cookies.
        * on the return page you will need FormItRetriever to access the cache for you and retrieve the form submission from memory (or you could use some other method to retrieve the data from the custom table)

        To access your history of searches you will need to write another snippet that queries your custom table from the perspective of a user and a superuser (the latter may be better done via a Custom Manager Page).

        ie it’s a non-trivial amount of effort.
          Writer > E-consultant > MODx developer || Salesforce || modx 2.x || PHP 5.2.13 || MySQL client 5.0.86
          • 22019
          • 390 Posts
          As of FormIt 1.5.0 there is also the option to send your values as JSON parameters as well. Not tried this yet, as I need to keep the will to live. (For the hard of humour, this is a joke aimed at myself, not a criticism of JSON or FormIt, or anything much really).
            Writer > E-consultant > MODx developer || Salesforce || modx 2.x || PHP 5.2.13 || MySQL client 5.0.86