You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a rare occurence of not initialized value of form component.
I have this problem with used Contributte/FormMultiplier. When I use multiplier for component UploadControl, with created (or removed) new field, error is appeared (Typed property Nette\Forms\Controls\BaseControl::$value must not be accessed before initialization).
Problematic code is $obj->$name = $control->getValue() (Forms\Container.php:160), because value is unset. Other form components like TextInput, hidden fields, etc. are okay due having empty string or similar value, only Upload has this problem.
I tried to set various default values or disable required of this field, but error persist.
With Nette Forms 3.1 there is no problem because $value is not typed.
Note for the end :)
I know that FormMultiplier is not prepared for Nette 4 yet, but this maybe should not be problem of this library?
Steps To Reproduce
$multiplier = $form->addMultiplier('m_photo', function (Container $container, Form $form) {
$container->addUpload('image')
->addRule(Form::IMAGE, 'Fotogragie musí být JPEG, PNG, WebP nebo GIF.')
}, 1, 10);
Possible Solution
Set default value to var $value in BaseControl
protected mixed $value = null;
The text was updated successfully, but these errors were encountered:
Version: 4.0.x-dev
Bug Description
There is a rare occurence of not initialized value of form component.
I have this problem with used Contributte/FormMultiplier. When I use multiplier for component UploadControl, with created (or removed) new field, error is appeared (Typed property Nette\Forms\Controls\BaseControl::$value must not be accessed before initialization).
Problematic code is
$obj->$name = $control->getValue()
(Forms\Container.php:160), because value is unset. Other form components like TextInput, hidden fields, etc. are okay due having empty string or similar value, only Upload has this problem.I tried to set various default values or disable required of this field, but error persist.
With Nette Forms 3.1 there is no problem because $value is not typed.
Note for the end :)
I know that FormMultiplier is not prepared for Nette 4 yet, but this maybe should not be problem of this library?
Steps To Reproduce
Possible Solution
Set default value to var $value in BaseControl
protected mixed $value = null;
The text was updated successfully, but these errors were encountered: