Forums

Adding Value (not key) of Selection to Email

jformicola 06 Feb, 2020
Hi!

How do I add the below concat value (not key) below to the email I'm sending out after this forms submit? I know it's possible, because I see it in the email when I select "INCLUDE Email enabled fields", but I want to make the output clearer, so I need to be able to call that information up myself.

Also, how do I have the email go to the persons email that is in the database, but not called thus far in the setup. The DB read pulls only the employee ID and Fullname as it feeds a drop down and I need to choose "Return an array of key/value pairs, two fields must be provided" to do so.



Array
(
    [read_data22] => Array
        (
            [log] => Array
                (
                    [0] => SELECT `Data22`.`ClassID` AS `Data22.ClassID`, `Data22`.`ClassName` AS `Data22.ClassName` FROM `tblclass` AS `Data22` LIMIT 100;
                )

            [var] => Array
                (
                    [365_OUTLOOK] => Office 365 - Outlook
                    [BLUE] => Blue Moon Integration
                    [BLUE_1] => Blue Moon / E-Signature
                    [COM_1] => Basic Computer Operating Skills
                    [CUSTOM_MULT] => Custom Training
                    [EXC_1] => Excel For Beginners
                    [EXC_2] => Excel - Intermediate Users
                    [EXC_3] => Excel - Advanced Users
                    [FHO_1] => Fair Housing Overview
                    [FHO_2] => Fair Housing Overview  - Maintenance
                    [INITIAL] => Initial Training 
                    [INITIAL_ADMIN] => Initial Training - Admin
                    [INITIAL_MAINTENANCE] => Initial Training - Maintenance
                    [MRIX] => MRI X Introduction
                    [MRI_1] => Initial MRI - Site Manager
                    [MRI_2] => Initial MRI - Leasing Agent
                    [MRI_3] => MRI Review - Site Manager
                    [MRI_4] => MRI Review - Leasing Agent
                    [MRI_5] => MRI Overview - Accounting
                    [NEWHIRE] => New Hire Orientation
                    [NEXUS] => Nexus Payables Introduction
                    [NEXUS2] => Nexus Follow-up
                    [NEXUS3] => Nexus
                    [ONSITE] => Onsite Training
                    [PSN] => Payment Service Network (PSN)
                    [RLL ] => RLL Overview
                    [BLUE_2] => Blue Moon On-The-Spot Lease
                    [Tablet1] => Tablet Rollout - Wave 1 (Jean's Properties)
                    [Tablet2] => Tablet Rollout - Wave 2 + 3 (all Others)
                    [SUPER] => Super User Instruction
                )

        )

    [read_data14] => Array
        (
            [log] => Array
                (
                    [0] => SELECT `Data14`.`ID` AS `Data14.ID`, CONCAT(`Data14`.`Subject` , ' (Training Notes- ' , Notes_For_Trainer,')') AS `Data14.text` FROM `tbltrainedtopics` AS `Data14` LIMIT 1000;
                )

            [var] => Array
                (
                    [1] => MRI  - Advance Date (Training Notes- Do before 9:30)
                    [15] => sub2 (Training Notes- note2)
                    [14] => sub2 (Training Notes- note2)
                    [16] => sub2 (Training Notes- note2)
                    [17] => sub2 (Training Notes- note2)
                    [18] => sub2 (Training Notes- note2)
                )

        )
After Submit


Array
(
    [chronoform] => trainingchecklist
    [event] => submit
    [TrainerEmpID] => 446
    [TraineeEmpID] => 1
    [what_day_did_you_train] => 2020-02-26 13:00:00
    [where_did_you_train] => 02
    [TrainedTopics] => Array
        (
            [0] => 1
            [1] => 15
        )

    [button12] => 
    [Itemid] => 275
    [option] => com_chronoforms6
    [view] => form
    [rows] => Array
        (
            [0] => Array
                (
                    [TrainedTopics] => 1
                )

            [1] => Array
                (
                    [TrainedTopics] => 15
                )

        )

)
Array
(
    [submit_validate_fields] => Array
        (
            [log] => Automatic validation enabled.
            [var] => 1
        )

    [save_data11] => Array
        (
            [data] => Array
                (
                    [DateOffered] => 2020-02-26 13:00:00
                    [ClassID] => SUPER
                    [Location] => 02
                    [DTEND] => 
                    [Lunch] => 
                    [TrainerEmpID] => 446
                    [TraineeEmpID] => 1
                    [what_day_did_you_train] => 2020-02-26 13:00:00
                    [where_did_you_train] => 02
                    [TrainedTopics] => ["1","15"]
                )

            [_success] => Data saved successfully
            [log] => Array
                (
                    [0] => INSERT INTO `tblsessions` (`DateOffered`, `ClassID`, `Location`, `DTEND`, `Lunch`, `TrainerEmpID`)  values  ('2020-02-26 13:00:00', 'SUPER', '02', '', '', '446');
                )

            [var] => Array
                (
                    [DateOffered] => 2020-02-26 13:00:00
                    [ClassID] => SUPER
                    [Location] => 02
                    [DTEND] => 
                    [Lunch] => 
                    [TrainerEmpID] => 446
                    [SessionID] => 10138
                )

        )

    [save_data6] => Array
        (
            [data] => Array
                (
                    [created] => 2020-02-06 16:19:50
                    [user_id] => 451
                    [SessionID] => 10138
                    [TrainerEmpID] => 446
                    [TraineeEmpID] => 1
                    [what_day_did_you_train] => 2020-02-26 13:00:00
                    [where_did_you_train] => 02
                    [TrainedTopics] => ["1","15"]
                )

            [_success] => Data saved successfully
            [log] => Array
                (
                    [0] => INSERT INTO `kam_chronoforms_data_trainingchecklist` (`created`, `user_id`, `SessionID`, `TrainerEmpID`, `TraineeEmpID`, `what_day_did_you_train`, `where_did_you_train`, `TrainedTopics`)  values  ('2020-02-06 16:19:50', '451', '10138', '446', '1', '2020-02-26 13:00:00', '02', '["1","15"]');
                )

            [var] => Array
                (
                    [created] => 2020-02-06 16:19:50
                    [user_id] => 451
                    [SessionID] => 10138
                    [TrainerEmpID] => 446
                    [TraineeEmpID] => 1
                    [what_day_did_you_train] => 2020-02-26 13:00:00
                    [where_did_you_train] => 02
                    [TrainedTopics] => ["1","15"]
                    [aid] => 260
                )

        )

    [tcpdf10] => Array
        (
            [path] => /home/traink5/public_html/joomlatools-files/docman-files/session-outlines/Session10138.pdf
            [var] => Array
                (
                    [path] => /home/traink5/public_html/joomlatools-files/docman-files/session-outlines/Session10138.pdf
                )

        )

    [save_data13] => Array
        (
            [data] => Array
                (
                    [Outline] => http://trainkamson.com/joomlatools-files/docman-files/session-outlines/Session10138.pdf
                )

            [_success] => Data saved successfully
            [log] => Array
                (
                    [0] => UPDATE `tblsessions` AS `Data13` SET `Outline` = 'http://trainkamson.com/joomlatools-files/docman-files/session-outlines/Session10138.pdf' WHERE `SessionID` = '10138';
                )

            [var] => Array
                (
                    [Outline] => http://trainkamson.com/joomlatools-files/docman-files/session-outlines/Session10138.pdf
                )

        )

    [save_data15] => Array
        (
            [data] => Array
                (
                    [SessionID] => 10138
                    [EmpId] => 1
                    [TrainerEmpID] => 446
                    [TraineeEmpID] => 1
                    [what_day_did_you_train] => 2020-02-26 13:00:00
                    [where_did_you_train] => 02
                    [TrainedTopics] => ["1","15"]
                )

            [_success] => Data saved successfully
            [log] => Array
                (
                    [0] => INSERT INTO `tblattendancelog` (`SessionID`, `EmpId`)  values  ('10138', '1');
                )

            [var] => Array
                (
                    [SessionID] => 10138
                    [EmpId] => 1
                    [CF_ID] => 1396
                )

        )

    [save_data20] => Array
        (
            [data] => Array
                (
                    [TrainedTopics] => 15
                    [aid] => 260
                )

            [_success] => Data saved successfully
            [log] => Array
                (
                    [0] => INSERT INTO `tbltrainedtopics_parsed` (`TrainedTopics`, `aid`)  values  ('15', '260');
                )

            [var] => Array
                (
                    [TrainedTopics] => 15
                    [aid] => 260
                )

        )

    [email26] => Array
        (
            [recipients] => Array
                (
                    [0] => jformicola@kamsoncorp.com
                )

            [subject] => New ChronoForm email received.
            [body] => 



TEST
 <table width="100%" cellpadding="5" cellspacing="3" border="0" class="ui table"><tr><td width="30%" valign="top" align="right"><strong>Who are you?</strong></td><td width="70%" valign="top" align="left">Sheridan, Claudine M.</td></tr><tr><td width="30%" valign="top" align="right"><strong>Who did you train?</strong></td><td width="70%" valign="top" align="left">Abels, Julie</td></tr><tr><td width="30%" valign="top" align="right"><strong>What date did you train?</strong></td><td width="70%" valign="top" align="left">2020-02-26 13:00:00</td></tr><tr><td width="30%" valign="top" align="right"><strong>Where did you train?</strong></td><td width="70%" valign="top" align="left">The Kamson Corporation</td></tr><tr><td width="30%" valign="top" align="right"><strong></strong></td><td width="70%" valign="top" align="left">MRI  - Advance Date (Training Notes- Do before 9:30), sub2 (Training Notes- note2)</td></tr></table>
TEST
<table cellpadding="5" cellspacing="5" border="0">
  <tr>
    <td><strong>TrainerEmpID</strong></td>
    <td>446</td>
  </tr>
            [result] => the Mail sent successfully.
            [var] => 1
        )

)
jformicola 06 Feb, 2020
Also, is it possible to have a check box enable or disable the email being sent? I've tried using the "actions" of the checkbox to disable the email action in the on submit but it doesn't work.

so the three questions are:

1. How do I include the concat value of a field in the email, what shortcode do I use to call it (see above)
2. How do I get the employees email address from the database to the form so that I can email it to them (it is present in the same table the db read uses)(also see above)
3. Can a checkbox on the form determine if the email is sent?

Please help! Thanks!
healyhatman 06 Feb, 2020
1. You don't - you need to re-read the database if you want to put that concatted thing in the email.
2. Re-read the database or include the email as a hidden field.
3. Yes. In your submit event you need an "event switcher" - data source will be {data:checkbox_field_name_goes_here}
jformicola 07 Feb, 2020
Ok, thank you sir. I'm workign through these.

For others: I found Max's comments here useful

https://www.chronoengine.com/forums/posts/t104928/populating-a-field-with-an-email-from-database-load-to-send-the-submitted-form-to-as-the-dynamic-to-email
This topic is locked and no more replies can be posted.