Input type number is storing as string
See original GitHub issueRedux@6.7.0
From the documentation, it says that inputs of type “number” will be stored as numbers. However, as you can see in my screenshot it is storing the values as a string. It would be awful if I have to parse them manually as this would be unnecessary looping.
Component
export const renderInput = ({ input, label, placeholder, type, meta: { touched, error } }) => (
<Form.Field>
<label>{label}</label>
<input {...input} type={type} placeholder={placeholder} class={'' + (touched && error) ? 'error' : ''} />
</Form.Field>
);
Field of type: number
<Field component={renderInput}
name="baseValue" label="Default value"
placeholder="0"
type="number"
/>
Issue Analytics
- State:
- Created 6 years ago
- Reactions:8
- Comments:16 (1 by maintainers)
Top Results From Across the Web
HTML input type="number" still returning a string when ...
In other words, type="number" is a hint to implement client-side validation and appropriate GUI controls but the underlying element will still store strings...
Read more >Why the number input is the worst input - Stack Overflow Blog
We do have an input that's labeled as a number, but when you add it to your form, it actually renders as <input...
Read more >input type=number – number input control (NEW) - HTML5
The input element with a type attribute whose value is " number " represents a precise control for setting the element's value to...
Read more ><input type="number"> - HTML: HyperText Markup Language
<input> elements of type number are used to let the user enter a number. They include built-in validation to reject non-numerical entries.
Read more >JS. How do you add input type " number" as a ... - Sololearn
JS. How do you add input type " number" as a number _ and avoid strings? · Getting NaN as the output IS...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You can use
parse
prop on Field.it would be great if the inputs of type ‘number’ remained numbers throughout the process! 😃