Call to undefined method (IControl)::getHtmlName()

Notice: This thread is very old.
Pavel Janda
Member | 977
+
0
-

Nette\Forms\Rules require in constructor just class that implements Nette\Forms\IControl, but:

If i create take a simple class that imeplements Nette\Forms\IControl and create new Nette\Forms\Rules and than try to export some rules, it throws and error: Call to undefined method SomeControl::getHtmlName(). Example:

class SomeControl implements Nette\Forms\IControl
{

	function setValue($value) {}
	function getValue() {}
	function validate() {}
	function getErrors() { return []; }
	function isOmitted() {}
	function translate($s, $count = NULL) { return $s; }

}

# ...

$rules = new Nette\Forms\Rules(new SomeControl);
$rules->addCondition(Form::EQUAL, 1)->toggle(1);

Nette\Forms\Helpers::exportRules($rules);

Last edited by Pavel Janda (2015-11-19 12:58)