Array ( [log] => Array ( [0] => SELECT `Data3`.`EMPId` AS `Data3.EMPId`, `Data3`.`FullName` AS `Data3.FullName` FROM `tblemployee` AS `Data3` ORDER BY `Data3.FullName` ASC LIMIT 1000; ) [var] => Array ( [1] => Abels, Julie [1090] => Abreu, Maria [79] => Abril, Manuel A.​I need another item here that displays the "FullName" then I should be able to output it on the email that is triggered after the form.Array( [option] => com_chronoforms6 [cont] => manager [chronoform] => trigger-summary [event] => submit [employee] => 228 [button6] => )"> Load both value and label (or second selected field) to array - Forums

Forums

Load both value and label (or second selected field) to array

jformicola 26 May, 2021
How do I go about loading both the value/key and a second field to the data array?

I have a dropdown that is being populated by a database read [read_data3] that is pulling two fields. When the person selects the option they want, only one field [EMPId] is making it to the array. I need "FullName" to make it too as I want to output the name on an email that is sent out after the form runs. I will still need the key to be EMPid as it is used is some custom sql/php that outputs a table onto the email. Does that make sense?

Thank you for any help!
Array
(
    [read_data3] => Array
        (
            [log] => Array
                (
                    [0] => SELECT `Data3`.`EMPId` AS `Data3.EMPId`, `Data3`.`FullName` AS `Data3.FullName` FROM `tblemployee` AS `Data3` ORDER BY `Data3.FullName` ASC LIMIT 1000;
                )

            [var] => Array
                (
                    [1] => Abels, Julie
                    [1090] => Abreu, Maria
                    [79] => Abril, Manuel A.

I need another item here that displays the "FullName" then I should be able to output it on the email that is triggered after the form.
Array
(
    [option] => com_chronoforms6
    [cont] => manager
    [chronoform] => trigger-summary
    [event] => submit
    [employee] => 228
    [button6] => 
)
GreyHead 27 May, 2021
Hi jformicola,

I suggest that you use a Read Data action on Submit to get all the info you need using the submitted Employee ID.

Bob
jformicola 27 May, 2021
Thanks Bob! I did that but I can't seem to now output the result on the email. Can you please look at the below debug data and tell me what variable shortcode I can use to add Jason's name to my email?
Array
(
    [chronoform] => trigger-summary
    [event] => submit
    [employee] => 228
    [button6] => 
    [Itemid] => 298
    [option] => com_chronoforms6
    [view] => form
)
Array
(
    [submit_validate_fields] => Array
        (
            [log] => Automatic validation enabled.
            [var] => 1
        )

    [read_data19] => Array
        (
            [log] => Array
                (
                    [0] => SELECT `Data19`.`FullName` AS `Data19.FullName` FROM `tblemployee` AS `Data19` WHERE `Data19`.`EMPId` = '228' LIMIT 100;
                )

            [var] => Array
                (
                    [Eifert, Jason R.] => Eifert, Jason R.
GreyHead 28 May, 2021
Hi jformicola,

I looked at healyhatman's shortcode list for CFv6 and he suggests {var:read_data19}

Bob
jformicola 28 May, 2021
Thanks, that seems to have done it!
You need to login to be able to post a reply.