-
-
Notifications
You must be signed in to change notification settings - Fork 151
Closed
Description
Version: 3.0.4
I know this is uninteresting use case.
Bug Description
If you want validate Integer by Numeric rule, than throw exception.
Steps To Reproduce
Here is form for sanbox. Let's fill value and send.
<?php declare(strict_types=1);
namespace App\Presenters;
use Nette\Application\UI\Form;
final class HomepagePresenter extends BasePresenter
{
protected function createComponentForm()
{
$form = new Form();
$form->addInteger('trim')
->addCondition($form::FILLED)
->addRule($form::NUMERIC, 'Musí být číslo.');
// my fix ->addRule($form::FILLED, 'Musí být číslo.');
$form->addSubmit('send');
$form->onSuccess[] = function ($form, $values) {
dumpe($values);
};
return $form;
}
}Expected Behavior
The form try to validate input value.
Possible Solution
In Validator::validateNumeric expected string but int given. Maybe cast value?
Metadata
Metadata
Assignees
Labels
No labels