Forums

Passing Arrays

katsikar 01 Feb, 2013
Hello,

I have build a complex sql query that gets data from 3 tables, and puts it in an array named $MemDates in a custom element field. I want to be able to proccess the results in the On Submit event of the same form. I try using this code in the custom element:

$form->data['SelDates']=$MemDates;

but the $SelDates array is not passed when I submit the form...(not shown when I put a Debbuger contol in the On Submit event). I also tried by adding Data to Session and Session to Data controls in the On Load and On Submit events, with no success...

How can I pass the $MemDates array to the On Submit event? Is the same method used for passing it to another form?

Thanks in advance,
Aris.
Max_admin 07 Feb, 2013
Hi Aris,

The variable scope is limited to the place where you obtained the results, say this happened in a custom code action under the "on load" event, then that variable will be accessible only in this action, if you want to make it available under all actions in the "on load" event then store it under the $form->data array (and do this under the same action).

If you want it to be available for other events or other forms then use the "Data to session" action after the code is loaded, then use the "Session to data" action later to bring it back.

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.