Amateur here....... I would like to populate a Dropdown element from the results from a preceding Field element, using a modified version of this code from the Wiki in 'Eval populate'.
How do I access the info from another form field?
Code:
$options[] = JHTML::_('select.option', '0', 'Please select' );
$db = JFactory::getDbo();
$reg_4vin = {a four digit number from the preceding Field element}
$myQuery = $myDb->getQuery(true);
$myQuery
->select('id', 'reg_4vin','reg_title')
->from('four_digit_data')
->where('reg_4_vin = ' . $myDb->quote($reg_4vin));
$myDb->setQuery($myQuery);
$rows = $db->loadObjectList();
foreach ($rows as $row) {
$options[] = JHTML::_('select.option', $row->id, $row->reg_title);
}
return $options;
How do I access the info from another form field?