Hi there.
Im looking to build a form where a user can select via multi tickbox and for every tickbox (is a hotel name) the system will have a defintion of email address per each hotel.
Then the form will send automatically an email to every hotel selected.
Can this be achieved via chronoform?
Pls if possible give a small example on how to achieve this.
Thanks
Im looking to build a form where a user can select via multi tickbox and for every tickbox (is a hotel name) the system will have a defintion of email address per each hotel.
Then the form will send automatically an email to every hotel selected.
Can this be achieved via chronoform?
Pls if possible give a small example on how to achieve this.
Thanks
Hi saveg,
You can do this with ChronoForms v4 using my custom Email [GH] action which (a) can handle an array of To Email addresses and (b) has an option to send separate emails.
You can probably do it with ChronoForms v5 but as far as I know the separate emails functionality isn't built in so you would need to hand-code the email sender.
Bob
You can do this with ChronoForms v4 using my custom Email [GH] action which (a) can handle an array of To Email addresses and (b) has an option to send separate emails.
You can probably do it with ChronoForms v5 but as far as I know the separate emails functionality isn't built in so you would need to hand-code the email sender.
Bob
Thanks alot for replying
just to get this right. Im using v5
however I will brief you on my requirement
I will make one form with tick boxes that has hotel names for a customer to request to book as:
Hotel1 -> send some form info to email x@x.com
Hotel2 -> send some form info to y@y.com
Hotel3 -> send some form info to z@z.com
... etc
Keep in mind that I will mask the real sender/customer email and will put my own email.
also I will be getting the full form details inclsuing the real sender email address sent via email to me only.
Also I will be posting the data into db.
this is briefly what Im after.
Can I do with v5 ?
just to get this right. Im using v5
however I will brief you on my requirement
I will make one form with tick boxes that has hotel names for a customer to request to book as:
Hotel1 -> send some form info to email x@x.com
Hotel2 -> send some form info to y@y.com
Hotel3 -> send some form info to z@z.com
... etc
Keep in mind that I will mask the real sender/customer email and will put my own email.
also I will be getting the full form details inclsuing the real sender email address sent via email to me only.
Also I will be posting the data into db.
this is briefly what Im after.
Can I do with v5 ?
Hi saveg,
Yes, except that "as far as I know the separate emails functionality isn't built in to CFv5 so you would need to hand-code the email sender."
Bob
Yes, except that "as far as I know the separate emails functionality isn't built in to CFv5 so you would need to hand-code the email sender."
Bob
Thanks alot for the reply and clarification.
Is it possible to give steps to do this and provide sample code for the one you mentioned?
Is it possible to give steps to do this and provide sample code for the one you mentioned?
Suppose that your hotels checkboxes group is named "hotels[]" and that the checkboxes values will be the hotels names below:
then use the "emails_to_use" in the "Dynamic to"
Regards,
Max
<?php
$emails = array (
'hotel1' => 'hotel1@example.com',
'hotel2' => 'hotel2@example.net',
'hotel3' => 'hotel3@example.com'
);
$form->data['emails_to_use'] = implode(",", array_intersect_key($emails, array_flip($form->data["hotels"])));
?>
then use the "emails_to_use" in the "Dynamic to"
Regards,
Max
The code above should be added to a "custom code" action BEFORE the "Email" action, you should not have a "Handle arrays" action before this code!
Regards,
Max
Regards,
Max
Thanks for sharing the code, Im testing it now, just wondering about checkbox id shall I use
hotels[]
or just hotels
and also the events shall I use std events or there is more
hotels[]
or just hotels
and also the events shall I use std events or there is more
ok I should tell you that I made it work. thanks alot for sharing the code, but it works only if I select one check box, if I select multi checkboxes, it will email the first one only,
see below for the debug info:
Data Array
Array
(
[option] => com_chronoforms5
[chronoform] => Book_a_Hotel
[event] => submit
[firstname] => N
[lastname] => Has
[checkindate] => 13-06-2014
[city] => IST
[hotels] => Array
(
[0] => hotel5
[1] => hotel4
)
[button6] => Submit
[emails_to_use] => h@XXX.net,has@XXX.net
[ip_address] => XX.XX.2.83
)
Array
(
)
Errors
Array
(
)
Debug Info
Array
(
[1] => Array
(
[Email] => Array
(
[0] => An email with the details below was sent successfully:
[1] => To:h@XXX.net, has@XXX.net
[2] => Subject:You got new booking PAL!
[3] => From name:WTA
[4] => From email:wta@example.com
[5] => CC:
[6] => BCC:
[7] => Reply name:
[8] => Reply email:
[9] => Attachments:
[10] => Body:
<table>
<tr><td>First Name</td><td>N</td></tr>
<tr><td>Last Name</td><td>Hassoonah</td></tr>
<tr><td>Check In Date</td><td>13-06-2014</td></tr>
<tr><td>Your City</td><td>IST</td></tr>
<tr><td>Which Hotel</td><td>array (
0 => 'hotel5',
1 => 'hotel4',
)</td></tr>
</table><br /><br />IP: XX.XX.2.83
)
)
)
see below for the debug info:
Data Array
Array
(
[option] => com_chronoforms5
[chronoform] => Book_a_Hotel
[event] => submit
[firstname] => N
[lastname] => Has
[checkindate] => 13-06-2014
[city] => IST
[hotels] => Array
(
[0] => hotel5
[1] => hotel4
)
[button6] => Submit
[emails_to_use] => h@XXX.net,has@XXX.net
[ip_address] => XX.XX.2.83
)
Array
(
)
Errors
Array
(
)
Debug Info
Array
(
[1] => Array
(
[Email] => Array
(
[0] => An email with the details below was sent successfully:
[1] => To:h@XXX.net, has@XXX.net
[2] => Subject:You got new booking PAL!
[3] => From name:WTA
[4] => From email:wta@example.com
[5] => CC:
[6] => BCC:
[7] => Reply name:
[8] => Reply email:
[9] => Attachments:
[10] => Body:
<table>
<tr><td>First Name</td><td>N</td></tr>
<tr><td>Last Name</td><td>Hassoonah</td></tr>
<tr><td>Check In Date</td><td>13-06-2014</td></tr>
<tr><td>Your City</td><td>IST</td></tr>
<tr><td>Which Hotel</td><td>array (
0 => 'hotel5',
1 => 'hotel4',
)</td></tr>
</table><br /><br />IP: XX.XX.2.83
)
)
)
This topic is locked and no more replies can be posted.