Skip to content
This repository has been archived by the owner on Jan 8, 2019. It is now read-only.

NumberInputField component accidentally stringifies its value #1596

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

NumberInputField component accidentally stringifies its value #1596

kroepke opened this issue Sep 7, 2015 · 0 comments
Assignees
Labels
Milestone

Comments

@kroepke
Copy link
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 pushed a commit that referenced this issue Sep 8, 2015
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 as completed in bbfb0b3 Sep 9, 2015
edmundoa pushed a commit that referenced this issue Oct 12, 2015
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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant