Skip to content

Number field doesn't accept floating point numbers #92

Closed
@player1537

Description

@player1537

For a project I'm working on, I need to be able to accept floating point numbers in one of my forms. Currently, when I try to input a floating point number in one of my fields that has the following schema:

{
    type: 'number',
    required: true,
    model: 'sample_thickness',
    label: 'Sample Thickness',
    hint: 'The thickness of the sample in mm',
    default: null,
}

I receive an error from Chrome when submitting:

screen shot 2016-11-01 at 4 54 11 pm

I don't currently have a v-on:click="submit" attribute on my button, which is the main reason that Chrome is intervening in the first place, however I feel that the fields should still accept floating point values.


One easy way to support floating point values is to use HTML5's step attribute on <input type="number"></input> tags. Setting step="0.1" causes the up/down buttons on the field to increase/decrease the number by 0.1. Additionally, setting it to step="any" causes any number to be accepted.

Where the schema currently accepts a max and min parameter, it could also accept an any parameter.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions