Hello,
I'm using the "Advanced" option for a radiobutton element in order to create some options, but I need to set a default value and I don't know what attributes should I add in order to set an option as "selected". This is my code:
The string retrieved from database looks like this, I want to set default selected value to be 1:
1~E-mail sau hartie|2~Integral pe hartie
Thank you
I'm using the "Advanced" option for a radiobutton element in order to create some options, but I need to set a default value and I don't know what attributes should I add in order to set an option as "selected". This is my code:
PHP:
$db = JFactory::getDbo();
$db->setQuery("SELECT valoare_camp_ro FROM contracts_tool_setari_6_repeat where alocare_grup = 9 and format_camp = 11");
$rows = $db->loadResult();
$valori = explode("|",$rows);
foreach ($valori as $valoare) {
list($id,$text) = explode("~",$valoare);
if (!isset($id)){
$id = $text;
}
$options[] = JHTML::_('select.option', trim($id), trim($text)); <--what other attributes can I have here?
}
return $options;
The string retrieved from database looks like this, I want to set default selected value to be 1:
1~E-mail sau hartie|2~Integral pe hartie
Thank you