Skip to content

Commit

Permalink
examples: fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Sep 21, 2016
1 parent 61f0213 commit 8cf6715
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 2 additions & 2 deletions examples/custom-control.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.');
}


Expand Down
4 changes: 0 additions & 4 deletions examples/custom-validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');


Expand Down

0 comments on commit 8cf6715

Please sign in to comment.