Commit 52a61ae3 authored by Ad Schellevis's avatar Ad Schellevis
parent 78ca1710
...@@ -117,7 +117,7 @@ class ModelRelationField extends BaseField ...@@ -117,7 +117,7 @@ class ModelRelationField extends BaseField
* select if multiple data nodes may be selected at once * select if multiple data nodes may be selected at once
* @param $value boolean value Y/N * @param $value boolean value Y/N
*/ */
public function setmultiple($value) public function setMultiple($value)
{ {
if (trim(strtoupper($value)) == "Y") { if (trim(strtoupper($value)) == "Y") {
$this->internalMultiSelect = true; $this->internalMultiSelect = true;
...@@ -162,9 +162,17 @@ class ModelRelationField extends BaseField ...@@ -162,9 +162,17 @@ class ModelRelationField extends BaseField
{ {
$validators = parent::getValidators(); $validators = parent::getValidators();
if ($this->internalValue != null) { if ($this->internalValue != null) {
// field may contain more than one entries if ($this->internalMultiSelect) {
$validators[] = new CsvListValidator(array('message' => $this->internalValidationMessage, // field may contain more than one entries
'domain'=>array_keys(self::$internalOptionList[$this->internalCacheKey]))); $validators[] = new CsvListValidator(array(
'message' => $this->internalValidationMessage,
'domain' => array_keys(self::$internalOptionList[$this->internalCacheKey])
));
} else {
// single value selection
$validators[] = new InclusionIn(array('message' => $this->internalValidationMessage,
'domain' => array_keys(self::$internalOptionList[$this->internalCacheKey])));
}
} }
return $validators; return $validators;
} }
......
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