We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30319
    • 406 Posts
    I have eForm redirecting to a different thank you page, with its own document ID.

    What’s the proper code for passing form variable values (e.g. name, email, comments, etc.) to this thank you page??

    Can anyone provide specific sample code??

    Thank you, Tom
      • 7239
      • 14 Posts
      Do you really need to go to a new page? If you do not the &thankyou parameter will load a chunk in place of your form, and that chunk can contain place holders for all of your form fields.

      So your snippet call could be:
      [!eForm? &formid=`yourForm` &to=`[email protected]` &tpl=`formTPL` &report=`reportTPL` &thankyou=`yourThankYouChunk`!]
      


      And then your thank you chunk could be:

      Thank You for Submitting.<br /><br />
      
      <strong><u>Submission Details:</u></strong><br />
      [+Name+]<br />
      [+Addr1+] [+Addr2+]<br />
      [+City+], [+State+] [+Zip+]<br />
      [+Phone+]<br /><br />
      
      This will be processed ASAP!<br /><br />
      
      Thank You for your business!<br /><br />
      
      [+debugText+]
        • 18463
        • 121 Posts
        Martijn van Turnhout Reply #3, 16 years, 5 months ago
        Hey,

        I got the same question. Suppose I want to put a link on a product page to another form. How can I pass on certain values, which are located on the product page, to the form page?

        I would love to know that. Any help would be much appreciated!
          • 30711
          • 70 Posts
          Tom,

          I am struggling with same issue here. Did you find any solution?

          Tommy
            • 23510
            • 168 Posts
            Check out eform2db. Its not what you want but the principle is there. Instead of saving the form to database, you want to assign some $_SESSION variables that can then be loaded on which ever page you want.
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              If you want to have a link on one page that goes to another page with a form, and include some values from the first page, you can add them as key=values to the URL query string, then collect them with a snippet on the second page using the GET array. Just keep in mind that if you’re using Friendly URLs the first one has to begin with a ?, while if you aren’t using Friendly URLs your first key=value pair has to begin with a & (the index.php?a=42 already uses the leading ?).

              I prefer to actually make that link on the first page a mini-form, with as many hidden fields as you need, and a submit button (styled to look like a link if you prefer). Then I use a snippet to collect the POST values and do whatever I need to with them.

              The only problem with loading these values into the SESSION is if the user sits on the first page long enough for his session to time out; in which case the values are lost. Cookies are one way of avoiding that loss; storing the values in a json or other encoded string for retrieval later. Again, a snippet is needed to retrieve the string from the COOKIE and process it.
                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