Hello
here s what i want to do. I ve have two emails setup in a chronoforms 3.2 form. Before sending,I need to check a value from the form, if this value starts with 10,11 and 12, email must be sent with email 1 setup, if value is something else, it has to be sent with email 2 setup
Can this be done easily ? I can t find how !
tks for your help !
				
				
				
			here s what i want to do. I ve have two emails setup in a chronoforms 3.2 form. Before sending,I need to check a value from the form, if this value starts with 10,11 and 12, email must be sent with email 1 setup, if value is something else, it has to be sent with email 2 setup
Can this be done easily ? I can t find how !
tks for your help !
					hello
tks for your link, looks great , i ve adapted the solution but it does not work, can you see where i am wrong?
tks !
				
				
				
			tks for your link, looks great , i ve adapted the solution but it does not work, can you see where i am wrong?
tks !
$MyForm =& CFChronoForm::getInstance('diaglecontenu');
$MyFormEmails =& CFEMails::getInstance($MyForm->formrow->id);
$codepostal = $_POST['text_5'];
$zipfirst2 = substr($codepostal,0,2);
if($zipfirst2  == "95" || $zipfirst2  == "78" || $zipfirst2  == "91" || $zipfirst2  == "77" || $zipfirst2  == "94" || $zipfirst2  == "75" || $zipfirst2  == "92" || $zipfirst2  == "93") {
$MyFormEmails->setEmailData(1, 'enabled', '1');//enable  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', '1');//disable email 2
$MyFormEmails->setEmailData(3, 'enabled', '1');//enable email 3
}
				
					Hi schlogo,
The code looks OK from a quick scan. How does it fail? That might give a clue. What do you see with Debug on?
Presumably this code is in the OnSubmit Before Email box?
I recall that previously we've had to set all the emails to 'disabled' in their Properties box - I'm not sure if that is needed here.
Bob
				
				
				
			The code looks OK from a quick scan. How does it fail? That might give a clue. What do you see with Debug on?
Presumably this code is in the OnSubmit Before Email box?
I recall that previously we've had to set all the emails to 'disabled' in their Properties box - I'm not sure if that is needed here.
Bob
					Hello
Sorry for the lack of information, it sends all the emails at every shot,i am going to disable the emails to see if it changes something. Maybe the substr is not working , i m digging
				
				
				
			Sorry for the lack of information, it sends all the emails at every shot,i am going to disable the emails to see if it changes something. Maybe the substr is not working , i m digging
This topic is locked and no more replies can be posted.
		
	
  