Hello,
I have some dropdowns that I want to populate in the onload of my form.
So started to build a test form to see how i could populate a datapath for a dynamic dropdown.
I added the following in a Custom Code action in on the onload of the form to be executed in the controller:
Got a debug after this code to see the data.
However when i test this form i get and error. But as soon as I remove the following lines
The debug is getting showed with the values of the arrays.
What I'm doing wrong here? Any idea why this is not working?
I have some dropdowns that I want to populate in the onload of my form.
So started to build a test form to see how i could populate a datapath for a dynamic dropdown.
I added the following in a Custom Code action in on the onload of the form to be executed in the controller:
<?php
$db2conn = array();
$db2conn['driver'] = 'mysql';
$db2conn['host'] = 'localhost';
$db2conn['user'] = '...';
$db2conn['password'] = '...';
$db2conn['database'] = '...';
$db2conn['prefix'] = '';
$db2 = & JDatabase::getInstance($db2conn);
$query = "select * from teams";
$db2->setQuery($query);
$db2->query();
$form->data['playdate'] = $db2->loadAssocList();
$form->data['End'] = 'End of DB Loads';
?>
Got a debug after this code to see the data.
However when i test this form i get and error. But as soon as I remove the following lines
$db2->query();
$form->data['playdate'] = $db2->loadAssocList();
The debug is getting showed with the values of the arrays.
What I'm doing wrong here? Any idea why this is not working?