public function validateValidItem()
{
if (!$this->value) {
return;
}
// load allowed values in values_list
// @todo Imants: Actually we don't need to load all values from Model in
// array, just to check couple of posted values.
// Probably we should do SELECT * FROM t WHERE id IN ($values) or
// something like that to limit array size and time spent on
// parsing all DB records in Model.
$this->getValueList();
$values = explode($this->separator, $this->value);
foreach ($values as $v) {
if (!isset($this->value_list[$v])) {
$this->displayFieldError("Value {$v} is not one of the offered values");
return $this->validate();
}
}
}