We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 34178
    • 212 Posts
    Does anybody know how to pass the value of variable from a hook to the page where formit redirects to? (the variable contains in most cases ~1.500 characters)

    Is it best to do it by a session variable?

    By a cookie?

    $hook->setValue + FormItRetriever?

    Unfortunately $modx->setPlaceholder does only work when not redirecting to another page. Or should this normally work?

    Does anybody know which way is best?

    Letti
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      See the "store" and "storeTime" properties for FormIt and the FormItRetriever snippet.

      http://rtfm.modx.com/display/ADDON/FormIt
      http://rtfm.modx.com/display/ADDON/FormIt.FormItRetriever
        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
        • 34178
        • 212 Posts
        Hi Susan,
        does FormItRetriever also works for placeholders or only for field valus of the form sent by formit?
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          If the hook inserts the variable into the fields array using $hook->setValue() then it should pass it on. It depends on what the hook is doing.
            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
            • 34178
            • 212 Posts
            Hi Susan,

            It depends on what the hook is doing.

            That´s the question. Do you think it is best to pass the content of a variable (containing ~1.500 characters) by:

            1. $hook->setValue + FormItRetriever?

            2. Session variable?

            3. Cookie?
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              I don't see that it would make any difference as far as performance goes; the data has to be passed and inserted somehow. I would keep life simple and use a hook and FormItRetriever, just so I keep it all in the FormIt family, so to speak. Getting tangled up in SESSION and COOKIE is not something I care to do unless it's absolutely necessary.
                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
                • 34178
                • 212 Posts
                Thanks for your estimation. So, I will choose $hook->setValue + FormItRetriever.

                Thanks again,
                Letti
                  • 34178
                  • 212 Posts
                  Hi Susan,
                  it seems like $hook->setValue is limited concerning the number of characters. Using this method we get a blank screen when transmitting bigger amounts of words ...
                    • 28042 ☆ A M B ☆
                    • 24,524 Posts
                    Break it up into two or three section with three placeholders.
                      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