Dropdown with recipients, without showing email-adress in HTML-Code

dkl

New Member
Hi,

i have to create a dropdown element where the user can choose between different recipients of the form data. the easy way is to create a dropdown where the value is the email-address (support@..., webmaster@..., ...) and the label is the name of the department (e.g. support, webmaster, ...).

with this solution the email-addresses are readable in the HTML source code. so, is it possible to solve this problem in another kind, that the email-address isn't shown for public? maybe with an ID that is linked with an email-address located in a database table?

thanks for your help and sorry for my english ... it's time for bed :cool:

greetings,
daniel


edit: just forgot to say that i'm using fabrik 1.5.2
 
The only way I could think of would be to add a hidden text element to the form, use anonymous numeric values for the actual dropdown (so instead of jim@foo.bar, use 1), and have a form submit script which then fills in the hidden element with the real email addresses accordingly. Use the hidden element as the value for the email receipt.

The script would look something like this:

PHP:
switch ($aData['table_name___email_dd']) {
    case '1':
        $aData['table_name___email_hidden'] = "jim@foo.bar";
        break;
    case '2':
        $aData['table_name___email_hidden'] = "fred@foo.bar";
        break;
    default:
        $aData['table_name___email_hidden'] = "jane@foo.bar";
}
Make the form "before form is processed, simple eval".

Substitute your table and element names as appropriate.

-- hugh
 
Hi cheesegrits and thanks for your fast reply,

I made a form with for elements: name (textfield), email_dd (dropdown), message (textarea) and email_hidden (textfield, hidden).

email_dd contains three values: 1,2,3

those emails should link to three email-adresses, written in this php-code, that i include in the form:
PHP:
switch ($aData['email_dd']) {
    case '1':
        $aData['email_hidden'] = "mail1@test.com";
        break;
    case '2':
        $aData['email_hidden'] = "mail2@test.com";
        break;
    case '3':
        $aData['email_hidden'] = "mail3@test.com";
        break;
    default:
        $aData['email_hidden'] = "mail_default@test.com";
}
Because I have no tables I deleted "table_name___" from your example, hoping that is right.

The form will be sent to "{email_hidden}".

Problem: You said, that I have to choose "before form is processed, simple eval", but I haven't this option in v1.0.5.2. I've choosed "As soon as form submitted (simple eval)".

When I try to send my form it doesn't work. Following error occurs:
Code:
Failed sending email to
Where is the missunderstanding? ???

Greetings,
Dan :)
 
Have a look at the source of your form page to see the actual element ID's. Or better yet, use FireFox with FireBug, and "inspect" the element you need to get the name for.

I seem to recall when there is no table, we still prepend something like jos_fb__ or something like that to the element names.

-- hugh
 
I seem to recall when there is no table, we still prepend something like jos_fb__ or something like that to the element names.

Great, it works ... e.g. the name is "jos_01_fabrik_data_1___email_hidden" :D

Thanks a lot! I will post the whole code later, have a lot of work to do.

Greetings,
Dan
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top