Kdyby / FormsReplicator

Other
30 stars 58 forks source link

Nette 2.1, setPrompt() on select doesnt work if you do not choose any value #27

Open matak opened 10 years ago

matak commented 10 years ago

<?php

    $form->addDynamic('_addItems', function (Container $item) use ($itemsIdWarehouse, $itemsAttribute) {

        $item->addSelect('idWarehouse', NULL, $itemsIdWarehouse)
                ->setDefaultValue(key($itemsIdWarehouse));

        $item->addSelect('attribute', NULL, $itemsAttribute)
                ->setPrompt("-");

        $item->addText('samples');
        $item->addText('quantity');
        $item->addText('date');
    }, 1);

?>

the result is error

The signal receiver component 'form' is not found.

because

Nette\InvalidArgumentException

Value '' is out of allowed range ['36', '37', '38', '39', '40'] in field 'attribute'.

...vendor\kdyby\forms-replicator\src\Kdyby\Replicator\Container.php:233 source Nette\Forms\Container-> setValues (arguments)

return parent::setValues($values, $erase);