1. Find out which input is causing the problem:
- Add this code to Factory
$form->onValidate[] = function (Nette\Forms\Form $form, $values) use ($product_id, $lang_id)
{
try {
$test = [];
foreach ($form->getComponents(true) as $component) {
if (!empty($component->getErrors())) {
$test[] = $component;
bd($component, $component->getErrors());
}
}
dd($test);
} catch (\Exception $exception) {
dd($exception);
}
dd($form->getOwnErrors());
};
- If it's a form validation, it will tell you where the error is after you submit the form. Either continue on your own or there are some common causes. If you don't get anything, the error is probably somewhere else.
1) The Cause
Task on Demo https://app.freelo.io/task/8146405.
SelectBox does not have a prompt, but it is not displayed in the template (it must have either a prompt or a selected value)
The solution is simple, just add ->setPrompt(true)$addToGallery->addSelect('gallery', 'Vyberte Galerii:', $galleries)
->setPrompt(true)
->addCondition($form::EQUAL, '---')
->toggle('new_gallery_input', true)
->elseCondition()
->toggle('new_gallery_input', false);