radio list loading without selected default value

hanees

New Member
I have a table with id and points.
id points
1 10
2 20
3 30

i am using below code to generate radio list in Eval populate. here issue is radio list loading without selected any value. i need to select id (2) as default value every time form loads. how to do it.

$db = JFactory::getDbo();
$db->setQuery('SELECT id, points FROM table ORDER BY id ASC');
$rows = $db->loadObjectList();
foreach ($rows as $row) {
$options[] = JHTML::_('select.option', $row->id, $row->points);
}
return $options;
 
Well, if you set the element's default to 2, it should default to that on a new form. From then on, it'll select whatever value the element has.

There's no built in way to set the selection arbitrarily when editing. Defaults only apply on a new form.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top