it needed some code in the main Zend/Form.php file within the isValid()
method. I will try to report my findings to ZF team through the Issue
Tracker, but basically I added a new piece of code to find nested arrays.
This is prefect for my site and will help me continue, but the actual code
would probably need more work.
Within the isValid() method I have replaced:
foreach ($this->getElements() as $key => $element) {
$element->setTranslator($translator);
if (!isset($data[$key])) {
$valid = $element->isValid(null, $data) && $valid;
} else {
$valid = $element->isValid($data[$key], $data) && $valid;
}
}
with:
foreach ($this->getElements() as $key => $element) {
$element->setTranslator($translator);
if (null != $element->getBelongsTo()) {
$parent_array = $data[$element->getBelongsTo()];
$key = $parent_array[$key];
$valid = $element->isValid($key, $data) && $valid;
} else {
if (!isset($data[$key])) {
$valid = $element->isValid(null, $data) && $valid;
} else {
$valid = $element->isValid($data[$key], $data) && $valid;
}
}
}
--
View this message in context: http://www.nabble.com/Problems-using-%22belongsTo%22-on-an-element-within-a-%22subform%22-tp25767284p25768985.html
Sent from the Zend MVC mailing list archive at Nabble.com.
没有评论:
发表评论