Thanks Susan, finally got it working.
For completeness here is the gist of what I did...
The
FormTemplate chunk:
<!-- Begin FormTemplate -->
<form id="FormID" method="post" action="[~[*id*]~]">
[+validationmessage+]
<label for="email">Your email: </label>
<input id="email" name="email" type="text" value="" eform="Email:email:1" />
<input id="prog_1" name="prog" type="radio" value="1" eform="someValidationText::1" />
<label for="prog_1">Choice 1</label>
<input id="prog_2" name="prog" type="radio" value="2" eform="someValidationText::1" />
<label for="prog_2">Choice 2</label>
<p>Please enter the anti spam code below:<br />
<img src="[+verimageurl+]" alt="verification code" border="1"/></p>
<p><label for="vericode">code</label>
<input type="text" name="vericode" size="20" /></p>
<input type="submit" name="submit" value="Submit" />
</form>
<!-- End FormTemplate -->
The
eFormFunctions snippet:
<php?
function fctOnBeforeMailSent( &$fields ) {
fct1 ($fields);
fct2 ($fields);
}
function fct1( &$fields ) {
$prog = [+prog+];
if ($prog == 1){
$prog_mod == "choice 1";}
elseif ($prog == 2){
$prog_mod == "choice 2";}
else {
$prog_mod == "choice ?";}
return true;
}
function fct1( &$fields ) {
// some other function if required
return true;
}
return '';
?>
The
Report chunk: I want to get the raw data only so I can handle it upon reception.
<!-- Begin Report -->
[+email+],[+prog+]
<!-- End Report -->
The
MessageToSendToClient chunk: Here the data is sent out in a readable form. The called function converts the raw data to something more useful.
<!-- Begin MessageToSendToClient -->
<p>You have submitted a form, here is your choice:</p>
<p>[+prog_mod+]
<!-- End MessageToSendToClient -->
The
EformCall chunk:
[!eFormFunctions!]
[!eForm?
&tpl=`FormTemplate`
&formid=`FormID`
&report=`Report`
&automessage=`MessageToSendToClient`
&eFormOnBeforeMailSent=`fctOnBeforeMailSent`
&to=`[email protected]`
&from=`[email protected]`
&fromname=`Sender Ltd.`
&subject=`You filled a form: here is some feedback.`
&thankyou=`ThanksChunkToLoadAfterSubmit`
&vericode=`1`
!]
Note using [[]] instead of [!!] failed to work on my system. &protectSubmit=`0` was required since I kept getting a warning message about duplicate entries, even if the data submitted was different.
In the ressource where the form is to appear, place: