You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a form control is used as an argument in the rule, then a numeric string is passed to the js validator and it's not parsed as float, so there is a wrong comparison made.
Example: '100' >= '2' is false in JavaScript.
Steps To Reproduce
$form = new \Nette\Forms\Form();
$form->addFloat('min_age', 'Min age')
->setDefaultValue(6);
$form->addFloat('max_age', 'Max age')
->setDefaultValue(100)
->addRule(\Nette\Forms\Form::Min, null, $form['min_age']);
$form->addSubmit('save', 'Save');
echo$form;
// on submit js error: Please enter a value greater than or equal to 6.
Expected Behavior
Floats and integers should be compared as numbers, not as strings.
Version: 3.1.14
Bug Description
Bug is related to the commit netteForms: min/max/range can compare strings.
When a form control is used as an argument in the rule, then a numeric string is passed to the js validator and it's not parsed as float, so there is a wrong comparison made.
Example: '100' >= '2' is false in JavaScript.
Steps To Reproduce
Expected Behavior
Floats and integers should be compared as numbers, not as strings.
Possible Solution
The text was updated successfully, but these errors were encountered: