Skip to content

Number field doesn't accept floating point numbers #92

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

Closed
player1537 opened this issue Nov 1, 2016 · 3 comments
Closed

Number field doesn't accept floating point numbers #92

player1537 opened this issue Nov 1, 2016 · 3 comments

Comments

@player1537
Copy link

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.

@icebob
Copy link
Member

icebob commented Nov 1, 2016

Good idea, thanks. I will add it.

  • Add step to number and input fields
  • Add to docs

@icebob
Copy link
Member

icebob commented Nov 3, 2016

Fixed, it will be released in v0.6.0

@icebob icebob closed this as completed Nov 3, 2016
@icebob
Copy link
Member

icebob commented Nov 14, 2016

Released

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants