You can get the
GET into your field using an eForm event. Here’s what I tried out on the demo site, with a simple text field named
subject replacing the drop-down selector:
<label for="cfSubj">Regarding
<input name="subject" id="cfSubj" class="text" type="text" eform="Form Subject::1"/></label>
You need a snippet to define the function that eForm will refer to, e.g.
<?php
//eFormExtender: functions for eForm events
function populateSubject(&$fields) {
$fields['subject'] = $_REQUEST['Product'];
}
return;
?>
Your form page will call this snippet before calling eForm, and eForm will have the parameter
&eformOnBeforeFormParse pointing to your function:
[!eFormExtender!]
[!eForm? &formid=`ContactForm` &subject=`[+subject+]`
&eFormOnBeforeFormParse=`populateSubject`
&to=`[(emailsender)]` &ccsender=`1` &tpl=`ContactForm`
&report=`ContactFormReport` &invalidClass=`invalidValue`
&requiredClass=`requiredValue` &cssStyle=`ContactStyles`
&gotoid=`46` !]
Call the page as
index.php?id=6&Product=beanies and you have
beanies in the subject field.
I’ve used this approach previously to set up a contact page to generate individualized emails to members of a committee. Looking at the eForm documentation, I was expecting
eFormOnBeforeFormMerge to be the hot candidate here, but testing it on my local install (with no mail sender) the field’s value did not seem to be preserved when I got the validation failures back, while
eFormOnBeforeFormParse was OK.
KP