I have many checkboxes groups in the form. I am also using handle array to clean up the results to email. My question is this: When one of the checkbox is checked, the result should be in the email. Not only that but a certain checkbox also calls for text box and that should also be in the email (I do not know how to make "if checked, then fill in text box" required so just going to leave that alone for simplicity's sake. All others are not to be in email.
This is what I have:
Monday {child_1_checkbox_mon}<br />
Bus to {child_1_bus_to_mon_address}<br />
Pick up by: {child_1_pick_up_mon_relation}<br />
Tuesday {child_1_checkbox_tues}<br />
Bus To: {child_1_bus_to_tues_address}<br />
Pick up by: {child_1_pick_up_tue_relation}<br />
For example, if someone fills in "Bus To:" that's what I want in email. If it isn't filled, then it's not to be in email, including the fields "Bus to".
How is this done?
Thank you.
This is what I have:
Monday {child_1_checkbox_mon}<br />
Bus to {child_1_bus_to_mon_address}<br />
Pick up by: {child_1_pick_up_mon_relation}<br />
Tuesday {child_1_checkbox_tues}<br />
Bus To: {child_1_bus_to_tues_address}<br />
Pick up by: {child_1_pick_up_tue_relation}<br />
For example, if someone fills in "Bus To:" that's what I want in email. If it isn't filled, then it's not to be in email, including the fields "Bus to".
How is this done?
Thank you.
Hi deafbiz,
Use this in a Custom Code action before the Email action.
Bob
Use this in a Custom Code action before the Email action.
<?php
$checkboxes = array(
'child_1_checkbox_mon' => 'Monday',
'child_1_bus_to_mon_address' => 'Bus to',
'child_1_pick_up_mon_relation' => 'Pick up by',
'child_1_checkbox_tue' => 'Tuesday',
'child_1_bus_to_tue_address' => 'Bus to',
'child_1_pick_up_tue_relation' => 'Pick up by'
);
$email_content = array();
foreach ( $checkboxes as $k => $v ) {
if ( isset($form->data[$k]) && $form->data[$k] ) {
$email_content[] = $v.': '.$form->data[$k];
}
}
$email_content = implode('<br />', $email_content);
?>
Then use {email_content} in the email template.Bob
Updated: some were missing a comma.
However, I'm still missing some information. This form is a combination of checkboxes Group plus Text Box. The Checkbox Group works, but the Text Box information is missing. I guess I'll have to play around a bit with it.
However, I'm still missing some information. This form is a combination of checkboxes Group plus Text Box. The Checkbox Group works, but the Text Box information is missing. I guess I'll have to play around a bit with it.
This topic is locked and no more replies can be posted.