set default selected option in Eval populate

hanees

New Member
how to use below code for radio list with default selected option in dropdown > advanced > Eval populate.


$db = JFactory::getDbo();
$db->setQuery('SELECT id, text FROM #__tablename');
$rows = $db->loadObjectList();
foreach ($rows as $row) {
$options[] = JHTML::_('select.option', $row->id, $row->text);
}
return $options;
 
Hi there

Old thread, but I might have an answer for you - or anybody who came across the same problem since:

You can customize your Add link in the list so that it hands over the default value you want to set. Copy/Past the normal Add link and add

&table___element=dafault_value

to it. This sets the value of your field to deafault_value and you still can change to one of the values that your eval populate renders.

Hope this helps.

:)Lori
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top