Skip to content

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

@xpavp03

Description

@xpavp03

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions