Commit 0ef87027 authored by Ad Schellevis's avatar Ad Schellevis

(mvc) add empty option when ModelRelationField is optional

parent 867b0600
......@@ -111,6 +111,11 @@ class ModelRelationField extends BaseField
$result = array ();
if (array_key_exists($this->internalCacheKey, self::$internalOptionList) &&
is_array(self::$internalOptionList[$this->internalCacheKey])) {
// if relation is not required, add empty option
if (!$this->internalIsRequired) {
$result[""] = array("value"=>"none", "selected" => 0);
}
foreach (self::$internalOptionList[$this->internalCacheKey] as $optKey => $optValue) {
if ($optKey == $this->internalValue && $this->internalValue != null) {
$selected = 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment