We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 15734
    • 70 Posts
    Hi,

    I’m not sure if I’m asking this in the right place but I can’t find a better one. I am trying to build a very simple site for employment applications. I have a TV setup for "jobNumber" on a page that describes the job. I’d like to be able to have the user click on a "apply now" button and be sent to a page with a simple name, address, e-mail, upload resume form... I’ve got all of the individual components working. Where I’m stuck is passing the value of the "jobNumber" TV to eform on the second page.

    Any suggestions would be appreciated.

    Thanks.
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Best to put it in the SESSION, then have the form grab it from the SESSION. You could also put it in a query string and take it from the GET array for the form. You’ll need a snippet to get it from the SESSION or the GET; I’d have the snippet make a placeholder out of it and call the snippet first thing on the form page.
        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
        • 15734
        • 70 Posts
        Yikes. I’m not that php savvy. Thanks for the info though. I’ll start the weekend with a goal. Cheers.
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Another way could be to have a mini-form, with the form’s action attribute set to your form page, and with a hidden input containing the job number (using the TV). Then you could use this snippet on your eform page...
          if(isset($_POST['jobnum']) && is_numeric($_POST['jobnum'])) { // minimal input validation
              $modx->setPlaceholder('JobNumber', $_POST['jobnum']);
          }
          return;
          

          Then in your eForm template you could use [+JobNumber+] wherever you wanted to use the job number. Just make sure your snippet is inserted before the eForm snippet.

          In PHP, POST values are always strings, so the is_numeric check is used; if you’re using some other form of job identifier (mixed alphanumeric, for example) then some other sanity check would be needed.
            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
            • 15734
            • 70 Posts
            Thanks. I really like MODx and the help on these forums is even better. I’ll be playing with your suggestions this weekend. Thanks a bunch.