-
-
Notifications
You must be signed in to change notification settings - Fork 149
netteForms.js handles empty inputs differently from server side #146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
…mbers (BC break) [Closes nette/forms#146]
In this case you should add |
That's misunderstanding. Sorry for unclear specification. |
netteForms.js validation was correct (empty string is not in interval) and PHP validation is now fixed (returns FALSE too). In your case you should add |
…mbers (BC break) [Closes nette/forms#146]
…mbers (BC break) [Closes nette/forms#146]
…mbers (BC break) [Closes nette/forms#146]
…mbers (BC break) [Closes nette/forms#146]
Thanks for help. I'm sorry the problem was on my side. I use input masking by maskedInput.js which sets its placeholder to empty input. Nette.validateControl was called on blur and placeholder was not cleared by maskedInput.js yet. So validation was correct but it was done on wrong event. Anyway my feeling is that calling of setRequired(FALSE) in this case is something strange because "not required" is a default state. addCondition(Form::FILLED) would make more sense. From my point of view should validation work with empty values in similar way like database works with empty values. "SELECT null BETWEEN 1 AND 59" returns NULL. So particular validation function should return NULL on empty value. NULL should be interpreted as correct value and no validation exception should be fired. |
This breaks some nette components like DatePicker, which use |
Can you write exact parameter values? |
This is big BC break in minor version. |
Fixed |
netteForms.js handles empty inputs differently from server side:
Example:
Following RANGE validation of empty input is always successful on server side (php) and always unsuccessful in browser (js).
The text was updated successfully, but these errors were encountered: