I have read through the posts in the forum relating to this topic, but I am unfortunately still confused! 😶
I have a form whose first field is a radio selection. The end user will select whether or not they will be participating in a trip. If they are going, the form will display many fields for entering the traveler's information. If they are not going, the form will display only a few fields.
If the user is going on the trip, the email sent to both the user and the company should contain all of the applicable fields on the form. If they are not going, the email to both the user and the company should only contain the limited number of fields.
I have created 4 emails for the form. They are as follows:
1 - Going on Trip: email generated to company, with all applicable fields included
2 - Going on Trip: email generated to user, with all applicable fields included
3 - Not Going on Trip: email generated to company, with only limited fields included
4 - Not Going on Trip: email generated to user, with only limited fields included
I have included the following code in the onSubmit Before Sending Emails area:
where 'going' and 'notgoing' are the values of the radio0 field.
When I execute the form, I receive an error message stating that at least one recipient email must be provided. I turned on debug and am attaching a screenshot of the message I receive.
Each of the four emails I defined above do have recipients defined. I apologize if I am being obtuse, but I just cannot get this to work!
Rick
I have a form whose first field is a radio selection. The end user will select whether or not they will be participating in a trip. If they are going, the form will display many fields for entering the traveler's information. If they are not going, the form will display only a few fields.
If the user is going on the trip, the email sent to both the user and the company should contain all of the applicable fields on the form. If they are not going, the email to both the user and the company should only contain the limited number of fields.
I have created 4 emails for the form. They are as follows:
1 - Going on Trip: email generated to company, with all applicable fields included
2 - Going on Trip: email generated to user, with all applicable fields included
3 - Not Going on Trip: email generated to company, with only limited fields included
4 - Not Going on Trip: email generated to user, with only limited fields included
I have included the following code in the onSubmit Before Sending Emails area:
<?php
$formname = JRequest::getVar('chronoformname');
if ( !$formname ) {
$params =& $mainframe->getPageParameters('com_chronocontact');
$formname = $params->get('formname');
}
$MyForm =& CFChronoForm::getInstance("$trip_registration");
$MyFormEmails =& CFEMails::getInstance($MyForm->formrow->id);
$answer_array = array (
'going' => 1,
'going' => 2,
'notgoing' => 3,
'notgoing' => 4,
);
$radio = JRequest::getVar( 'radio0', '', 'post');
$radio = explode(',', $radio0);
echo '<div>$radio: '.print_r($radio0, true).'</div>'; // add this line
foreach ( $radio as $v ) {
$v = $answer_array[$v];
$MyFormEmails->setEmailData($v, 'enabled', '1');
}
?>
where 'going' and 'notgoing' are the values of the radio0 field.
When I execute the form, I receive an error message stating that at least one recipient email must be provided. I turned on debug and am attaching a screenshot of the message I receive.
Each of the four emails I defined above do have recipients defined. I apologize if I am being obtuse, but I just cannot get this to work!
Rick