Hello,
I'm facing the following problem which I can't solve myself due to a lack of php knowledge.
I have a simple form in which people choose an event through a dropdownbox. The selected value has to determine the email format which they receive in the confirmation mail.
Example:
dropdown value: activity 1 > emailtemplate 1 for conformation email
dropdown value: activity 2 > emailtemplate 2 for conformation email
etc.
Is this possible?
Thanks for any help!
I'm facing the following problem which I can't solve myself due to a lack of php knowledge.
I have a simple form in which people choose an event through a dropdownbox. The selected value has to determine the email format which they receive in the confirmation mail.
Example:
dropdown value: activity 1 > emailtemplate 1 for conformation email
dropdown value: activity 2 > emailtemplate 2 for conformation email
etc.
Is this possible?
Thanks for any help!
Hi stan,
Assuming you have 2 emails with 2 different templates, you may switch them on and off to do what you need, here is a quick code:
Change form/fields name in my code above based on yours!
Cheers
Max
Assuming you have 2 emails with 2 different templates, you may switch them on and off to do what you need, here is a quick code:
$MyForm =& CFChronoForm::getInstance('myformname');
$MyFormEmails =& CFEMails::getInstance($MyForm->formrow->id);
if($_POST['dropdown_name'] == 'activity1'){
$MyFormEmails->setEmailData(1, 'enabled', '0');//disable email 1
$MyFormEmails->setEmailData(2, 'enabled', '1');//enable email 2
}else{
$MyFormEmails->setEmailData(1, 'enabled', '1');//enable email 1
$MyFormEmails->setEmailData(2, 'enabled', '0');//disable email 2
}
Change form/fields name in my code above based on yours!
Cheers
Max
Hi Stan,
in the onSubmit Before email code box!
Regards
Max
in the onSubmit Before email code box!
Regards
Max
I am attempting the same type of thing. When the first condition is met, it is working fine, but when it is one of the other two conditions no email is sent. Here is my code:
Anyone see anything wrong?
Thanks
$MyForm =& CFChronoForm::getInstance('TestScheduleChange');
$MyFormEmails =& CFEMails::getInstance($MyForm->formrow->id);
if($_POST['change'] == 'Addition'){
$MyFormEmails->setEmailData(1, 'enabled', '1');//enable email 1
$MyFormEmails->setEmailData(2, 'enabled', '0');//disable email 2
$MyFormEmails->setEmailData(3, 'enabled', '0');//disable email 3
}elseif($_POST['change'] == 'Cancellation'){
$MyFormEmails->setEmailData(1, 'enabled', '0');//disable email 1
$MyFormEmails->setEmailData(2, 'enabled', '1');//enable email 2
$MyFormEmails->setEmailData(3, 'enabled', '0');//disable email 3
}else{
$MyFormEmails->setEmailData(1, 'enabled', '0');//disable email 1
$MyFormEmails->setEmailData(2, 'enabled', '0');//disable email 2
$MyFormEmails->setEmailData(3, 'enabled', '1');//enable email 3
}
Anyone see anything wrong?
Thanks
I'm trying this in CF4:
doesnt work.. why?
<?php
if($form->data['length'] == "wrong"){
$form->data['email1'] = "xxx@gmail.com"
}
else{
$form->data['email1'] = "{$form->data['email']}"
}
?>
doesnt work.. why?
ok, got part of it.
Conditional email send for CF4:
forgot the ;
its a custom html action in "on submit" before the email action. However all I do is change a variable.
I don't know anything about coding, sorry about me asking in the first place
How can I send either one or the other email?
Conditional email send for CF4:
<?php
if($form->data['length'] == "wrong"){
$form->data['email1'] = "xxx@gmail.com";
}
else{
$form->data['email1'] = "{$form->data['email']}";
}
?>
forgot the ;
its a custom html action in "on submit" before the email action. However all I do is change a variable.
I don't know anything about coding, sorry about me asking in the first place
How can I send either one or the other email?
This topic is locked and no more replies can be posted.