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

NumberInputField component accidentally stringifies its value #1596

Closed
kroepke opened this Issue Sep 7, 2015 · 0 comments

Comments

Projects
None yet
1 participant
@kroepke
Contributor

kroepke commented Sep 7, 2015

By using the event's target value without converting it to a Number object, the value can be stringified, leading to errors when saving it, see Graylog2/graylog2-server#1399

Convert values to Number before propagating the change. Currently only the AlarmCallbackConfiguration dialog is affected, outputs already convert types in the REST API and inputs are still form encoded (thereby having Play correctly translate values).

@kroepke kroepke added the bug label Sep 7, 2015

@kroepke kroepke self-assigned this Sep 7, 2015

@kroepke kroepke added this to the 1.2.0 milestone Sep 7, 2015

edmundoa added a commit that referenced this issue Sep 8, 2015

Add default validation to NumberField
Check if numbers are between MIN_SAFE_INTEGER and MAX_SAFE_INTEGER if no
other validation is defined. In that way we avoid using unsafe JS
numbers and also weirdness with exponential format.

Refs #1596

@kroepke kroepke closed this in bbfb0b3 Sep 9, 2015

edmundoa added a commit that referenced this issue Oct 12, 2015

Allow negative and empty values on numeric fields
On entities using the `ConfigurationForm` component, use `undefined`
as value for empty or non-numeric values on a `NumericField`.

- Numeric values are still converted into a number, avoiding #1596
- Non-numeric values will raise an error when the browser validates
  the input
- Empty values will be treated as default values in optional input
  fields, or will raise an error otherwise

Fixes #1628
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment