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::$checkAllowedValues in ChoiceControl::getValue()

holantomas opened this issue · comments

  • bug report? yes
  • feature request? N/A
  • version: v2.4.7

Description

Hi, maybe I missed something but shouldn't be used ChoiceControl::$checkAllowedValues in ChoiceControl::getValue()? If I'm using dynamic selectbox and loading items over ajax, it's returning NULL as value. So it doesn't care about value of $checkAllowedValues.

I mean something like that:

	/**
	 * Returns selected key.
	 * @return string|int
	 */
	public function getValue()
	{
		return array_key_exists($this->value, $this->items) || !$this->checkAllowedValues ? $this->value : null;
	}