-
Notifications
You must be signed in to change notification settings - Fork 48
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
form with FloadField required=false passes validation with wrong value #83
Comments
How are you getting user input into the form? Having > var TestForm= forms.Form.extend({
... amount: forms.FloatField({label: 'Amount', required: false, maxValue: 1})
... })
> var f = new TestForm({data: {amount: ''}})
> f.validate()
true
> f.cleanedData
{ amount: null } > var f = new TestForm({data: {amount: 'asdfasdf'}})
> f.validate()
false
> f.cleanedData
{}
> f.errors().asText()
* amount
* Enter a number. The behaviour of |
I've prepeared a jsfiddle with this error https://jsfiddle.net/23Lmvcc7/ |
Looks like this is due to this field using an
|
You are right. I've fixed my issue by moving _onSubmit function from button onClick to form onSubmit. Maybe I'm wrong, but I remember developers of angularjs have fixed this problem. You can use number field with novalidate form and have a nice angularjs validating error. PS |
I have a form with
When I input there randome string, like 'asdfasdf'
form.validate() returns true, form.cleanedData returns {amount: null}
When I input a big number, like 123 it throws me validating error "Ensure this value is less than or equal to 1."
Is it a correct behaviour ?
The text was updated successfully, but these errors were encountered: