We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 27519
    • 275 Posts
    I have the following situation:

    Form A : offers a list to the user; user selects item from list and submits Form A

    Formit handles Form A with:

    [[!Formit? &hooks=`redirect` &redirectTo=`30`]]

    Form B: processes the selected item from Form A

    Form B is the redirect "30" used in the Formit call in Form A
    The items are a set of values set by a Javascript routine into hidden input fields in Form A prior to submitting Form A

    Am I correct to assume that these values should be available in Form B when I define the same hidden fields in Form B?

    If not, does that then implicate that Formit cannot be used for situations where one has multiple chained forms that complete a specific process?
      MODx Revolution / MAMP / OS X
      • 28215
      • 4,149 Posts
      This is related to http://github.com/splittingred/FormIt/issues#issue/8 and will be added in a later version.

      The only way you could do this now is with a custom hook that stores the values somewhere, and a snippet before your FormIt call in the 2nd page that loads those values and makes them placeholders.
        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
        • 27519
        • 275 Posts
        Thanks!

        When you say "placeholders", do you mean hidden input fields or something else?

        Could you give an example of how to make a placeholder if you don’t mean hidden inputs.

        Sorry for the ignorance, but I’m rather new at modx...
          MODx Revolution / MAMP / OS X
          • 27519
          • 275 Posts
          I think I figured it out.

          made a snippet that does the following:

          <?php
            $modx->setPlaceholder("name", $_SESSION["last-form"]["name"]);
          ?>​
          


          I can now use [[+name]] in the second form.

          By the way: I came across a handy thing in $_SESSION.
          There’s an array called ’last-form’ which holds all posted values of the last form.
          I wasn’t aware of this. Is this standard PHP or is this a modx feature?
            MODx Revolution / MAMP / OS X
          • I believe it’s a formit thing; it’s used to prevent re-submitting exactly the same form.
              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