When I submit my form I get the email with the correct Subject but there is nothing in the email.
Here is what I got:
[!eForm? &formid=`SubmitForm` &to=`[email protected]` &tpl=`SubmitForm` &category=`Contact Requests` &format=`name:Name:string:1,email:Email:email:1,message:Message:html:1`!]
Apologies if I’ve missed the answer elsewhere, but this is the first time I’ve tried to implement eForm using a dropdown menu for subject and sending to more than one email address....
I’m using a dropdown for subject that also determines the recipient email. Sending to one email was fine and I could plug in the subject into the email, but when allowing sending to different emails, it seems that the dropdown values must be set to 1, 2, 3, n instead of a subject value to determine the appropriate email address.
This works fine for determining the email to send to but now the subject is listed as 1, 2, n.
Is there a way to use one dropdown to select the subject and recipient, route to that email address, and allow that subject line to show up in the email?
<?php
//event function
function onBeforeMailSentFunction( &$fields ){
//array of subjects
$subjectArray = array(
"Subject 1",
"Subject 2",
"Subject 3",
"Subject 4"
);
//get value of selectSubject
$i = (int)$fields['selectSubject'];
if ($i>0) $i--;
$fields['subject'] = ( isset($subjectArray[$i]))?$subjectArray[$i]:$subjectArray[0];
return true;
}
?>
if(count($_POST==0) && !preg_match('/<input[^>]*?name=[\'"]formid[\'"]/i',$tpl)){
if(count($_POST)==0 && !preg_match('/<input[^>]*?name=[\'"]formid[\'"]/i',$tpl)){
NOTE: changed count($_POST==0) to count($_POST)==0
Am I way off base with this?
<?php // eform.inc.php (Line 183)
if (!is_numeric($value)) {
// not valid...
} ?><?php if (!is_numeric($value) && $isRequired){ ?><input type="hidden" name="formid" value="myform"></form>

!ctype_digit( (string) $value ) // or (int) $value > 0
I’m experiencing some weirdness in 1.4.3...
Using <form id="myform" ... > method, the hidden formid is added on the first load:
<input type="hidden" name="formid" value="myform"></form>
If submit a blank form (revealing validation message), the hidden formid is not added, and my NEXT submission is "validation-less"
Let me do some further testing to confirm this...
if(count($_POST)==0
You are right! Wrong assumption by me. Replacing line 78 with this should fix it. (leaving out the count($_POST)==0 test)
Nice! Glad to help.
If submit a blank form (revealing validation message), the hidden formid is not added, and my NEXT submission is "validation-less"
if(!preg_match('/<input[^>]*?name=[\'"]formid[\'"]/i',$tpl)){
This should be changed to:
Code:
<?php if (!is_numeric($value) && $isRequired){ ?>
Since an empty value equates to NaN, we also check to see if the field is required.
<?php if (strlen($value)>0 && !is_numeric($value)){ ?>version => '1.4.3'
This discussion is closed to further replies. Keep calm and carry on.