Hi,
I wish I can create a Dropdown which has as key data from a READ DATA e value from one another.
Is that possible?
Thanks!
Sure is! Add a second model in the read data action for your other table. Then the first one should still return key/value pairs and you will be retrieving
model1.field
model2.field
Sure is! Add a second model in the read data action for your other table. Then the first one should still return key/value pairs and you will be retrieving
model1.field
model2.field
thanks Healyhatman!
In the end I prefered using Php action.
I have two dropdowns: the second one uses the following action to retrieve an array key='id' , value='name' :
---------------------------------------------------------------------------------------------------
$opzioni = [];
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
// Select records
$query->select($db->quoteName(array('id', 'name')));
$query->from($db->quoteName('#__fields_values', 'v'));
$query->join('INNER', $db->quoteName('#__kizgv_users', 'u') . ' ON (' . $db->quoteName('u.id') . ' = ' . $db->quoteName('v.item_id') . ')');
$query->where($db->quoteName('value') . ' = '. $db->quote($form->data['select1']));
// Reset the query using our newly populated query object.
$db->setQuery($query);
// Load the results as a list of stdClass objects (see later for more options on retrieving data).
$opzioni = $db->loadAssocList('id','name');
return $opzioni;
------------------------------------------------------------------------------------------------
Thou, it is not loading the dropdown.
Can you kindly spot any issue?
Thanks!!