question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

b-form-input type="number" not allowing to enter decimals(.) on Firefox

See original GitHub issue

I have a number field on my form

<b-form-input type="number" v-model.number="param.default" mousewheel.native="$event.preventDefault()"/>

I used to be able to enter decimals like “3.5” or “10.0”, etc… but it stopped working recently. I’ve confirmed that the same issue exists on the bootstrap-vue website - under “Type number:” section (https://bootstrap-vue.js.org/docs/components/form-input/)

Strangely, I can still enter a decimal if I type it elsewhere, and copy / paste into the form field. b-form-input seems to be preventing me from entering “.” character.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

11reactions
tmorehousecommented, Aug 21, 2018

You might need to add attributes to set the step values

See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/number#Allowing_decimal_values

One issue with number inputs is that their step size is 1 by default — if you try to enter a number with a decimal, such as “1.0”, it will be considered invalid. If you want to enter a value that requires decimals, you’ll need to reflect this in the step value (e.g. step=“0.01” to allow decimals to two decimal places).

<b-form-input type="number" ... step="0.01" min="0.00" max="1000.00" >
1reaction
ilhanyumercommented, Apr 25, 2019

Thanks. I’ve added .number. Also step="any".

<input type="number" v-model.number="kilometre" step="any">
<input type="number" v-model.number="mil" step="any">
Read more comments on GitHub >

github_iconTop Results From Across the Web

Firefox does not allow decimals in input[type=number]
I have a simple input[type=number] field and when I try to type a decimal value in it (e.g. 4.5), the browser puts an...
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 >
Provide a way to allow <input type=number> to display its ...
This bug is about allowing content authors to specify that they want a fixed number of decimal places to be used when a...
Read more >
<input type="range"> - HTML: HyperText Markup Language
elements of type range let the user specify a numeric value which must be ... for range inputs is 1, allowing only integers...
Read more >
decimal symbol is a comma for input type=number but OS is ...
It also did this on Windows 7. Other browsers do accept the point symbol.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found