nette / forms

📝 Generating, validating and processing secure forms in PHP. Handy API, fully customizable, server & client side validation and mature design.

Home Page:https://doc.nette.org/forms

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ChoiceControl::getRawValue(): Return value must be of type string|int, null returned

forgie1 opened this issue · comments

Version: 3.2.0

Bug Description

BaseControl::$value may be null, so ChoiceControl::getRawValue() should return also null.
SelectBox::$value may be null if SelectBox was disabled (e.g. conditionally).

$form = new Nette\Application\UI\Form();
$form->addSelect('xyz', 'Xyz', ['X' =>'x', 'Y' => 'y'])->setDisabled();
$form->onSuccess[] = function (Nette\Application\UI\Form $form) {
	$form['xyz']->getRawValue();
};