diff --git a/examples/custom-control.php b/examples/custom-control.php index 9c80d555b..45e7d5e06 100644 --- a/examples/custom-control.php +++ b/examples/custom-control.php @@ -26,8 +26,8 @@ class DateInput extends Nette\Forms\Controls\BaseControl public function __construct($label = NULL) { parent::__construct($label); - $this->addCondition(Form::FILLED) - ->addRule(__CLASS__ . '::validateDate', 'Date is invalid.'); + $this->setRequired(FALSE) + ->addRule([__CLASS__, 'validateDate'], 'Date is invalid.'); } diff --git a/examples/custom-validator.php b/examples/custom-validator.php index 902aaf5b9..7be5de757 100644 --- a/examples/custom-validator.php +++ b/examples/custom-validator.php @@ -32,10 +32,6 @@ static function divisibilityValidator($item, $arg) ->setDefaultValue(5) ->addRule('MyValidators::divisibilityValidator', 'First number must be %d multiple', 8); -$form->addText('num2', 'Not multiple of 5:') - ->setDefaultValue(5) - ->addRule(~'MyValidators::divisibilityValidator', 'Second number must not be %d multiple', 5); // negative - $form->addSubmit('submit', 'Send');