Skip to content

Commit 6523fc1

Browse files
committed
Set values anytime. Previous behaviour was hack for bug in nette/forms (see issue #19)
1 parent cdb3fa3 commit 6523fc1

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
@@ -227,11 +227,9 @@ public function createOne($name = NULL)
227227
*/
228228
public function setValues($values, $erase = FALSE, $onlyDisabled = FALSE)
229229
{
230-
if (!$this->form->isAnchored() || !$this->form->isSubmitted()) {
231-
foreach ($values as $name => $value) {
232-
if ((is_array($value) || $value instanceof \Traversable) && !$this->getComponent($name, FALSE)) {
233-
$this->createOne($name);
234-
}
230+
foreach ($values as $name => $value) {
231+
if ((is_array($value) || $value instanceof \Traversable) && !$this->getComponent($name, FALSE)) {
232+
$this->createOne($name);
235233
}
236234
}
237235

@@ -250,11 +248,7 @@ protected function loadHttpData()
250248
return;
251249
}
252250

253-
foreach ((array) $this->getHttpData() as $name => $value) {
254-
if ((is_array($value) || $value instanceof \Traversable) && !$this->getComponent($name, FALSE)) {
255-
$this->createOne($name);
256-
}
257-
}
251+
$this->setValues((array) $this->getHttpData());
258252
}
259253

260254

0 commit comments

Comments
 (0)