We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Čau, mám dotaz snažím se přijít na to jak správně z Action metody nastavit multiplieru defaultní hodnoty tak jako se klasicky dělá.
viz...
$this['eventTermForm']->setDefaults([ 'terms_id' => $terms->terms_id, 'event_id' => $terms->event_id, //'date' => $terms->date, 'price' => $terms->price, 'capacity' => $terms->capacity ]);
A formulář
protected function createComponentEventTermForm() { $copies = 1; $maxCopies = 7; $form = new Form(); $form->addHidden('terms_id'); $form->addSelect('event_id', '', $this->termsRepository->getSelectEvent()) ->setPrompt('Vyberte Lekci') ->setRequired('Lekce je povinná!'); $multiplier = $form->addMultiplier('multiplier', function (\Nette\Forms\Container $container, \Nette\Forms\Form $form) { $container->addText('date') ->setRequired('Datum je povinné!'); }, $copies, $maxCopies); $multiplier->addCreateButton('Přidat další datum') ->addClass('btn btn-primary'); $multiplier->addRemoveButton('Odstranit datum') ->addClass('btn btn-danger'); $form->addText('price') ->setRequired('Cena je povinná!'); $form->addText('capacity') ->setRequired('Kapacita je povinná!'); $form->addCheckbox('all'); $form->addSubmit('send'); $form->onSuccess[] = [$this, 'eventTermFormSucceeded']; return $form; }
Hledal jsem nějaké řešení ale nic moc jsem nenašel díky moc...
The text was updated successfully, but these errors were encountered:
V masteru by mělo fungovat:
$this['eventTermForm']->setDefaults([ 'multiplier' => [ ['date' => '2042'], ['date' => '2043'], ['date' => '2044'], ], ]);
Sorry, something went wrong.
V masteru by mělo fungovat: $this['eventTermForm']->setDefaults([ 'multiplier' => [ ['date' => '2042'], ['date' => '2043'], ['date' => '2044'], ], ]);
Super tak to funguje 👍 Oprava:
$formDate = new DateTime($terms->date); $this['eventTermForm']->setDefaults([ 'terms_id' => $terms->terms_id, 'event_id' => $terms->event_id, 'multiplier' => [ ['date' => $formDate->format('Y-m-d\TH:i:s')] ], 'price' => $terms->price, 'capacity' => $terms->capacity ]);
Poté se to tam zobrazuje v pořádku :)
No branches or pull requests
Čau,
mám dotaz snažím se přijít na to jak správně z Action metody nastavit multiplieru defaultní hodnoty tak jako se klasicky dělá.
viz...
A formulář
Hledal jsem nějaké řešení ale nic moc jsem nenašel díky moc...
The text was updated successfully, but these errors were encountered: