onSubmit Events Code (V3 -> V4)

abasel 16 Apr, 2012
In version 3 I was able to set the e-mail address depending on the subject of the e-mail by setting the following code in the "onSubmit Events Code" section

<?php
$emails_2 = array('General Question'=>'reception@x.school.nz', 'Absentees'=>'reception@x.school.nz','Enrolments'=>'ifairhurst@x.school.nz','Sports'=>'sports@x.school.nz','International'=>'international@x.school.nz','Accounts'=>'accounts@x.school.nz','IT'=>'admin@x.school.nz');
$MyForm =& CFChronoForm::getInstance('forms_contactus');
$MyFormEmails =& CFEMails::getInstance($MyForm->formrow->id);
$MyFormEmails->setEmailData(1, 'to', $emails_2[$_POST['subject']]);
?> 


Where do I do this in Version 4 and is there any changes that I need to make to the above code?
GreyHead 16 Apr, 2012
Hi abasel,

Please see this post.

Drag a Custom Code action into the On Submit event and move it up before the Email action.

Bob
This topic is locked and no more replies can be posted.