Closed afdstudio closed 1 day ago
You can use page event and plugin event like so:
function onInit()
{
\Event::listen('formBuilder.beforeSendMessage', function ($form, $data) {
if ($data['location'] == 'Location 1') {
$form->recipients = [
[
'email' => 'email1',
'recipient_name' => 'name1',
],
];
}
});
}
Hi @mplodowski Thank you very much for your help. It is working. I really appreciate your help!
As I am not expert on coding, can you explain how did I get the option key value (email) selected on dropdown form? With this code, I am getting the "Option Label". If I get the Option Key, it will save me a lot of time.
function onInit() { \Event::listen('formBuilder.beforeSendMessage', function ($form, $data) { if ($data['pontoavic'] == 'Melgaço') { $form->recipients = [ [ 'email' => 'edgarafonso@icloud.com', // option key here 'recipient_name' => $data['pontoavic'], ], ]; } }); }
\Event::listen('formBuilder.beforeSendMessage', function ($form, $data) {
$form->recipients = [
[
'email' => post('pontoavic')
'recipient_name' => $data['pontoavic'],
],
];
});
Remove this first option (none) for empty item and use field placeholder instead. I assume this field is required.
Hi @mplodowski Thank you! I will try! Great support!
Is your feature request related to a problem? Please describe.
I need that a form is sent to a specific e-mail as follow:
Client would select a Store Location on the form as shown: Location 1 Location 2 Location 3
Then, the form should be sent to specific e-mail according to location selected. Example: If client selects Location 1, the form should be sent to email_1 If client selects Location 2, the form should be sent to email_2 If client selects Location 3, the form should be sent to email_3
Is there a way to workaround with this feature?
Thank you in advance!