Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

not accepting POST data when addDynamic() called as the first form item #8

Open
xpavp03 opened this issue Apr 9, 2013 · 0 comments
Labels

Comments

@xpavp03
Copy link

xpavp03 commented Apr 9, 2013

Hi Filip,
here's a pseudo code that demonstrates the issue:

    $form = new NAppForm($parent, $name);

    $form->addDynamic('players', function (NFormContainer $container) {
      $container->addText('rank');
    });

    $form->addHidden('tournament_id');

When defined like this, I can set default values, render the form manually with {input players-$playerId-rank} however, it won't load submitted values into players upon submit because $this->getComponents() in NFormContainer/getValues() loop returns nothing. So when I call $form->values in my processing method I get an empty iterator/array for players.

If however, I place the hidden item before the dynamic one, everything works fine:

    $form = new NAppForm($parent, $name);

    $form->addHidden('tournament_id');

    $form->addDynamic('players', function (NFormContainer $container) {
      $container->addText('rank');
    });

Please let me know if you're able to replicate the issue. If not, I would send a full test app (probably next month though, I'm short of time right now).

Nette Framework 2.0.8 (revision b7f6732 released on 2013-01-01)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant