-
-
Notifications
You must be signed in to change notification settings - Fork 245
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
Number fields are defaulted to either min or max values from schema, even when optional #58
Comments
It shouldn't happen with Yes, current implementation of |
Behavior definitely needs to be changed for optional fields, but I also think its strange to set an initial value even when required. In my opinion you want to force the user to input a value, not default to either the max or min. If someone wants a default, they can set the model. |
Yep, I've fixed behaviour of optional fields, but I'm still thinking about those |
This has not been fixed for me with rc.23 |
You mean |
Yes, I have an budget: {
type: Number,
max: 2147483647,
optional: true,
} Regarding providing default values whether or not the field is optional, html does not have that behaviour, other form frameworks don't have it, it is certainly unexpected for me to find out that the form framework is providing default values for me when I don't explicitly tell it to. I would want to user to think first before entering a value there. When there is an initial value provided automatically, it kind of leads the user to ignore that field because human perception kind of works like that. An input is something you put things in, and if there already is something in there, you automatically think you are done with it and don't even check if you wanted to enter the correct number in there. So a default should not be provided in any case. Just bad UX! |
And FWIW I agree that adding a initial value based off min / max is odd behavior. Like I said previously, if the developer wishes to set a default, they can do so with the model. |
When using a schema definition with either min, max, or both, the field is defaulted to either the min (if min is present), max (if only max is present). This is true for schema definitions where optional : true as well. This situation occurs for both TextField and NumField.
I would expect to see a blank field instead of defaulting to either min or max, especially for an optional field.
Example code and output:
Result:
![localhost_3005_register_player_athletics](https://cloud.githubusercontent.com/assets/8363924/16494797/b0a94c20-3eb8-11e6-98df-75e535aa8671.png)
The text was updated successfully, but these errors were encountered: