11 Posts
Cleber
7 years ago
4
Topic

Hello everyone!

I am creating a contact form where the user will select the department to contact in a simple select field (property rental, sale of real estate and for sale

I need that after selecting the department, the email field (destination) would direct the message to the specified department, type:
Lease imóveis---------------------------------- locacao@xxxx.com
Sale of real estate----------------------------venda@xxx.com
For Sale------------------------------------------compra@xxx.com

In the override, I was thinking of something like:
<? Php
if ($department 'Lease imóveis'): $department = 'locacao';

elseif ($department == 'Sale of real estate '): $department = 'locacao';

else: $department = 'compra ';

endif;
?>

The question is how can I insert $department in the message destination field SEBLOD form, type: <? Php $ Department; ?> @ Xxx.com.


Thank you in advance any contribution.

Sincerely,

Cleber

Get a VIP membership
4229 Posts
Kadministrator
7 years ago
0
Level 1

Hi,

you can do that with override, you need to use code pack afterStore event. In email field set field recepients to some field, then in afterStore event set this fields value to desired target email like this $fields['some_field']->value = $department;

11 Posts
Cleber
7 years ago
2
Level 1

Hello, Klas!

I am grateful for your attention and help.

During the last night, after some tests, I got a solution without the need to override the form.

As I said, I have a simple selection department, with the options (Locação, Venda and Compra). I created three emails fields for recipients (Locação,Venda and Compra). For each of these email fields established a conditional:

Email for Locação=== Conditional state (is enable when departament is equal Locação;

Email for Venda=== Conditional state (is enable when departament is equal Venda;

Email for Compra=== Conditional state (is enable when departament is equal Compra;

These e-mail fields to the recipients are in the hidden position. I tested and worked perfectly.

OBS .: I do not know why, but if we put the email fields in any other position with variation (hidden) conditional will not work.

Again thank you for your guidance.

Cleber

4229 Posts
Kadministrator
7 years ago
1
Level 2

Hi,

conditionals are also an option but  there is potential problem related to this - email addresses are still visible in the source code so spamers can read them.

11 Posts
Cleber
7 years ago
0
Level 3

Hi, Klas!

thank you for your guidance.

Cleber

Get a VIP membership