From this post http://www.chronoengine.com/forums.html?cont=posts&f=5&t=86288 I gather that I can use a dynamic to address in my form but I would not like to simply list my email addresses in the forms option values and be visible to the world.
Is it possible to use the custom code or something to pass the email address after the form has been submitted?
Let's assume I have a dropdown with 3 options, A, B & C. Somewhere I want to define the values like below and have the form send an email to whichever user is selected without putting the email addresses in the option values.
a= [email]a@domain.com[/email]
b= [email]b@domain.com[/email]
c= [email]c@domain.com[/email]
Thanks for the help!
Is it possible to use the custom code or something to pass the email address after the form has been submitted?
Let's assume I have a dropdown with 3 options, A, B & C. Somewhere I want to define the values like below and have the form send an email to whichever user is selected without putting the email addresses in the option values.
a= [email]a@domain.com[/email]
b= [email]b@domain.com[/email]
c= [email]c@domain.com[/email]
Thanks for the help!
Thanks, I missed that FAQ!
I have one problem with that method, hopefully you can also help me with that. I've pretty much used the FAQ code and field names exactly and I can get the operation to function on a basic form but for some reason it doesn't seem to operate correctly in my multi page form that I've created in the wizard. My problem is that even though I select 'em4' in my form and the debugger shows recipients=em4, for some reason "email_to_use" keeps saying [email]em1@domain.com[/email].
Here is my custom code:
I have named the select box "recipients" and I have labeled each option em1-em7. In my custom code I have
In my debugging here is what I have:
I have one problem with that method, hopefully you can also help me with that. I've pretty much used the FAQ code and field names exactly and I can get the operation to function on a basic form but for some reason it doesn't seem to operate correctly in my multi page form that I've created in the wizard. My problem is that even though I select 'em4' in my form and the debugger shows recipients=em4, for some reason "email_to_use" keeps saying [email]em1@domain.com[/email].
Here is my custom code:
<?php
$recipient = JRequest::getString('recipients', 'em1', 'post');
$emails = array (
'em1' => 'em1@domain.com',
'em2' => 'em2@domain.com',
'em3' => 'em3@domain.com',
'em4' => 'em4@domain.com',
'em5' => 'em5@domain.com',
'em6' => 'em6@domain.com',
'em7' => 'em7@domain.com' );
$form->data['email_to_use'] = $emails[$recipient];
?>I have named the select box "recipients" and I have labeled each option em1-em7. In my custom code I have
In my debugging here is what I have:
Data Array:
Array
(
[option] => com_chronoforms
[chronoform] => Claim
[event] => submit
[cf_sid] => 27f051433bee08777b1493dee620097a
[Itemid] =>
[Insurance_Company] => Test
[Adjusting_Company] => Test
[Adjuster_Name] => TEst
[Adjuster_Phone] => 1234567890
[Adjuster_Fax] => 1234567890
[Adjuster_Email] => test@mydomain.com
[Claim_Number] => 12345
[Date_Of_Loss] => 2012-12-12
[Emergency] => Yes
[Special_Notes] => Test
[input_submit_2] => Submit
[ae1b386979f0fe7eb4c2807ea31c45b5] => 1
[cfu_profile_usertype] =>
[recipients] => em4
[cfu_profile_company] =>
[cfu_name] =>
[cfu_profile_address1] =>
[cfu_profile_address2] =>
[cfu_profile_city] =>
[cfu_profile_state] =>
[cfu_profile_postal_code] =>
[cfu_email] =>
[Insured_Name] => Test
[Insured_Address] => 1234 Test
[Insured_City] => Springfield
[Insured_State] => IL
[Insured_Zip] => 12345
[Insured_Primary_Phone] => 1234567890
[Insured_Cell_Phone] => 1234567890
[Insured_Other_Phone] =>
[input_submit_36] => Next page
[fe4fba9f9dca94e9592790d23e7d4065] => 1
[cfu_id] => 0
[cfu_username] =>
[cfu_block] =>
[cfu_registerDate] =>
[cfu_lastvisitDate] =>
[cfu_params] => Array
(
)
[cfu_groups] => Array
(
)
[cfu_guest] => 1
[cfu_lastResetTime] =>
[cfu_resetCount] =>
[cfu_aid] => 0
[cfu_params_language] =>
[cfu_params_editor] =>
[cfu_params_timezone] =>
[cfu_profile] => Array
(
[company] =>
[address1] =>
[address2] =>
[city] =>
[state] =>
[region] =>
[country] =>
[postal_code] =>
[phone] =>
[website] =>
[favoritebook] =>
[usertype] =>
[aboutme] =>
[tos] =>
[dob] =>
)
[email_to_use] => em1@domain.com
)
Validation Errors:
Array
(
)
Thanks for submitting our form!
Debug Data1.
User info1. Array ( [cfu_id] => 0 [cfu_name] => [cfu_username] => [cfu_email] => [cfu_block] => [cfu_registerDate] => [cfu_lastvisitDate] => [cfu_params] => Array ( ) [cfu_groups] => Array ( ) [cfu_guest] => 1 [cfu_lastResetTime] => [cfu_resetCount] => [cfu_aid] => 0 [cfu_params_language] => [cfu_params_editor] => [cfu_params_timezone] => [cfu_profile] => Array ( [company] => [address1] => [address2] => [city] => [state] => [region] => [country] => [postal_code] => [phone] => [website] => [favoritebook] => [usertype] => [aboutme] => [tos] => [dob] => ) )
As a test I went back in and created a new form, one element at a time to see exactly when the "email_to_use" variable quit functioning and I have been able to confirm that it is as soon as I add the multi page elements.
My form only has two pages and the email select field was originally on page one. As a test I have moved that field down to page two and the custom code works perfectly. Any idea why the custom code wouldn't work if the field is on page one?
My form only has two pages and the email select field was originally on page one. As a test I have moved that field down to page two and the custom code works perfectly. Any idea why the custom code wouldn't work if the field is on page one?
Hi Wudaben,
At a guess . . . is the Multi-page action before your Custom Code action? Then the new value of $form->data['email_to_use'] probably isn't being transferred because it didn't exist when the Multi-page action ran.
Bob
At a guess . . . is the Multi-page action before your Custom Code action? Then the new value of $form->data['email_to_use'] probably isn't being transferred because it didn't exist when the Multi-page action ran.
Bob
This topic is locked and no more replies can be posted.
