We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38670
    • 11 Posts
    Hi, Do anyone know how to include the URL and title from the post in the eForm?

    I want to do a "send to a friend" form and include the link of the page where it is sent from.

    I've looking for this everywhere and I can't find it.

    Thanks!
      • 16278
      • 928 Posts
      You can use the eForm &eformOnBeforeMailSent event to create placeholders containing the relevant data for your report form. You need to create a snippet containing a PHP function that sets the fields, e.g.
      <?php
      //setPageInfo - put page info into fields for eForm report
      //refer to in eForm call as &eformOnBeforeMailSent=`setPageInfo`
      //precede eForm call with [!setPageInfo !] 
      
      function setPageInfo(&$fields) {
      	global $modx;
          $fields['pageUrl'] = 'http:' . '//' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
          $fields['pageName'] = $modx->documentObject['pagetitle'];
          return true;
      ?>
      }

      (I had to split the http:// to keep forum software mangling it)
      :) KP
        • 38670
        • 11 Posts
        Thank you so much, it worked perfect!