Skip to content

Commit 114f5d2

Browse files
committed
Set values anytime. Previous behaviour was hack for bug in nette/forms (see issue #19)
1 parent 4cd9a40 commit 114f5d2

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

Diff for: src/Kdyby/Replicator/Container.php

+4-10
Original file line numberDiff line numberDiff line change
@@ -224,11 +224,9 @@ public function createOne($name = NULL)
224224
*/
225225
public function setValues($values, $erase = FALSE, $onlyDisabled = FALSE)
226226
{
227-
if (!$this->form->isAnchored() || !$this->form->isSubmitted()) {
228-
foreach ($values as $name => $value) {
229-
if ((is_array($value) || $value instanceof \Traversable) && !$this->getComponent($name, FALSE)) {
230-
$this->createOne($name);
231-
}
227+
foreach ($values as $name => $value) {
228+
if ((is_array($value) || $value instanceof \Traversable) && !$this->getComponent($name, FALSE)) {
229+
$this->createOne($name);
232230
}
233231
}
234232

@@ -247,11 +245,7 @@ protected function loadHttpData()
247245
return;
248246
}
249247

250-
foreach ((array) $this->getHttpData() as $name => $value) {
251-
if ((is_array($value) || $value instanceof \Traversable) && !$this->getComponent($name, FALSE)) {
252-
$this->createOne($name);
253-
}
254-
}
248+
$this->setValues((array) $this->getHttpData());
255249
}
256250

257251

0 commit comments

Comments
 (0)