Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Trying to solve the issue ZF2-558 with the solution provided by Chris

Willis, if you set the options values and you have InArray Validator the
patch update the validator too
  • Loading branch information...
commit 294a7d18a832ce5eb297b43832c2b67db77fb425 1 parent 836249f
Carlos Nacianceno authored
7 library/Zend/Form/Element/MultiCheckbox.php
View
@@ -62,6 +62,13 @@ public function getValueOptions()
public function setValueOptions(array $options)
{
$this->valueOptions = $options;
+
+ // Update InArray validator haystack
+ if (!is_null($this->validator)) {
+ $validator = $this->validator->getValidator();
+ $validator->setHaystack($this->getValueOptionsValues());
+ }
+
return $this;
}
7 library/Zend/Form/Element/Select.php
View
@@ -80,6 +80,13 @@ public function getValueOptions()
public function setValueOptions(array $options)
{
$this->valueOptions = $options;
+
+ // Update InArray validator haystack
+ if (!is_null($this->validator)) {
+ $validator = $this->validator instanceof InArray ? $this->validator : $this->validator->getValidator();
+ $validator->setHaystack($this->getValueOptionsValues());
+ }
+
return $this;
}
Please sign in to comment.
Something went wrong with that request. Please try again.