Reading from an array within the form data array

How to display a specific value from a nested array in ChronoForms.

Overview

The issue occurs when trying to access a value within a nested array in the form data, as the standard placeholder returns the entire array instead of the desired element.
Use dot notation in your placeholder to specify the exact key within the nested array. For example, to display the 'name' value from the 'staffid' array, use the placeholder {staffid.name}.

Answered
ch chriso0258 24 Feb, 2014
Hello,

My debugger information is this:

Array
(
    [chronoform] => staffid
    [event] => Page2
    [barcode] => bi01d35
    [staffid] => Array
        (
            [bi_number] => bi01d35
            [name] => My Name
        )

    [button9] => Finish
)


I'm using a custom code to display the barcode number and the name. For the barcode information I'm using the following:

Staff: {barcode}


However, I can't get the name to appear. I've tried numerous formats but I guess I'm not correctly accessing the staffid array. What format should I use to display My Name in my form?

Thanks for your help.
ch chriso0258 24 Feb, 2014
Thanks for your reply but I'm not trying to save the data to a db. I've read the data from the db and want to display it. I'm using a custom code element. If I use the following code:

Staff Name: {barcode} - {staffid}


I get this:

Staff Name: bi01d35 - array ( 'bi_number' => 'bi01d35', 'name' => 'My Name', )


However, what I want to see is this:
Staff Name: bi01d35 - My Name


So, how do I format the staffid array to only display My Name?
Max_admin Max_admin 02 Mar, 2014
Answer
Please try
{staffid.name}


Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.