Open peterpp opened 10 years ago
Do you know how to solve this?
No, I'm currently very busy and I have no time to investigate.
@fprochazka any idea how to solve this?
What version of Nette?
Nette 2.2.2 (revision 8f701b9 released on 2014-06-26)
have you had time to look at this? or can you point me to the right direction how to fix this?
@fprochazka can I provide anything for you to ease up process of fixing this? I'd love to fix it (or have it fixed ideally :) ) ASAP. Thanks!
The setDefaultValue
is a really complicated problem and as a workaround, you should for now do ->setValues()
when you're creating new container.
OK, thanks
@fprochazka Can you please specify how this is complicated? Maybe I am missing something. I tried to move addComponent
from here after Callback::invoke
and everything seems to be working fine.
In my opinion, problem is, that addComponent
sets parent and therefore check here causes that default value is not set.
If I am right, I can send you pull request.
@foxycode it was complicated, because the internals of forms were rapidly changing and I was unable to maintain 100% compatibility. If you can send a pullrequest with testcase I'll be happy to accept it.
@fprochazka I give up. I tried, but it's really not so easy as I thought.
I worked around this issue by using setValue() instead of setDefaultValue(). It is internal. I know. It is more of a hack than a solution. But maybe it helps.
In my opinion, problem is, that
addComponent
sets parent and therefore check here causes that default value is not set.
From what I see the problem is that the setDefaultValue
only sets the value in case the form was not yet submitted, but it obviously is because of the way the replicator works.
@josefsabl I know and it works ok when you use setValue()
in attached()
method. I already switched to https://github.com/contributte/forms-multiplier
After adding new dynamic container to form, default value of container item is not applied.
Example:
Value of "name" text input should be be set to "default value", but it is empty.