Ok... So, I know that the following works with my original form...
FORM NAME: DVOPApplicationForm
Step 1: Field which has a field name of "recipients".
Step 2: Custom Code entry as first item in "On Submit"
Step 3: TCPDF action which produces a PDF exactly how I want it.
Step 4: Email, with dynamic email address, with the "Dynamic To" field set to "email_to_use"
Step 5: Fill out form, hit submit, it works as expected.
In my other form, which is for updating the DB table that the original information is pulled from, form, I currently have the following:
FORM NAME: DVOPApplicationFormMWStaffReferral
Step 1: Field which has a field name of "dvopid[DVOPSReferredTo]". (dvopid is the model id for matching a record to data)
Step 2: Custom Code entry as first item in "On Submit"
Step 3: Email action, with dynamic email address, with the "Dynamic To" field set to "dvop_selected"
Step 4: Submit the form, and I get an error which says:
•Mailer Error: You must provide at least one recipient email address.
I believe my error is located at the last line which contains below, but I am not sure what that line should look like... if it is elsewhere, please correct me... I am definitely learning php with this....
FORM NAME: DVOPApplicationForm
Step 1: Field which has a field name of "recipients".
Step 2: Custom Code entry as first item in "On Submit"
<?php
/*Staff Email Selection*/
if ( isset($form->data['recipients']) && $form->data['recipients'] ) {
$recipient = $form->data['recipients'];
}
$emails = array (
'Muskegon' => 'email@domain.org',
'Oceana' => 'email@domain.org',
'Ottawa' => 'email@domain.org' );
$form->data['email_to_use'] = $emails[$recipient];
?>
Step 3: TCPDF action which produces a PDF exactly how I want it.
Step 4: Email, with dynamic email address, with the "Dynamic To" field set to "email_to_use"
Step 5: Fill out form, hit submit, it works as expected.
In my other form, which is for updating the DB table that the original information is pulled from, form, I currently have the following:
FORM NAME: DVOPApplicationFormMWStaffReferral
Step 1: Field which has a field name of "dvopid[DVOPSReferredTo]". (dvopid is the model id for matching a record to data)
Step 2: Custom Code entry as first item in "On Submit"
<?php
/* */
/* DVOPS Selection */
if ( isset($form->data['dvopid']['DVOPSReferredTo']) && $form->data['dvopid']['DVOPSReferredTo'] ) {
$['dvopid']['DVOPSReferredTo'] = $form->data['dvopid']['DVOPSReferredTo'];
}
$emails = array (
'Kelly Berger' => 'email@domain.org' );
$form->data['dvop_selected'] = $emails[$dvopid][$DVOPSReferredTo];
/* */
?>
Step 3: Email action, with dynamic email address, with the "Dynamic To" field set to "dvop_selected"
Step 4: Submit the form, and I get an error which says:
•Mailer Error: You must provide at least one recipient email address.
I believe my error is located at the last line which contains below, but I am not sure what that line should look like... if it is elsewhere, please correct me... I am definitely learning php with this....
$form->data['dvop_selected'] = $emails[$dvopid][$DVOPSReferredTo];