Here is an eForm example I used for a site:
getEvent
<?php
if( !function_exists('getEvent') ){
function getEvent(&$fields,&$templates){
global $modx;
$pjpevent = strip_tags(intval($_GET['event']));
if($pjpevent){
$opt['docid'] = $pjpevent;
$opt['field'] = 'pagetitle';
$title = $modx->runSnippet('GetField', $opt);
$templates['tpl'] = str_replace('[+event+]', $title, $templates['tpl']);
}
return true;
}
}
?>
Then I call it:
[!getEvent!]
[!eformPreventXSS!]
[!eForm? &formid=`feedbackForm` &to=`[email protected]` &tpl=`eformForm` &report=`eformReport` &thankyou=`eformThanks` &vericode=`1` &eFormOnBeforeFormParse=`getEvent` &eFormOnBeforeMailSent=`eformPreventXSS` &subject=`Feedback from website`!]
I assign the link url to this form with ?event=[*id*] from the event page, then the function goes write a value to the [+event+]
placeholder in the form tpl. In this case I use runSnippet and get the pagetitle.
Maybe not the best coding, but an example for ya!