Hi, hier nochmal mein funktionierender Code, dem Select-Field werden 2 Werte hinzugefügt, die auch 'valid' sind:
PHP-Code:
public function fillSelect(Widget $objWidget, $strForm, $arrForm)
{
if ($arrForm['id']==34 && $objWidget->id==1491)
{
// Daten aus DB holen
$result = $this->Database->prepare("SELECT options FROM tl_form_field WHERE id= ?")->execute($objWidget->id);
$arrOptions = unserialize($result->options);
$arrNewOptions=array( "2016"=>"2016",
"2017"=>"2017");
while($value = each($arrNewOptions))
{
$arrOptions[] = array(
'value' => $value['value'],
'label' => $value['key'],
);
}
$objWidget->__set('options', serialize($arrOptions));
}
return $objWidget;
}
VG
Michel
Lesezeichen