Comments (6)
Thanks for catching this. The issue seems to be that we set the input type to number but do not specify a step property (which seems to default to 1).
https://www.w3schools.com/tags/att_input_type_number.asp
https://stackoverflow.com/questions/48892570/please-enter-a-valid-value-the-two-nearest-valid-value-is
We can fix this by introducing a method getInputStep, similar to getInputType or alternatively by setting step to any by default. This would probably make the up/down arrows disappear.
from json-schema-form.
Thanks for the quick response.
I did a test using the any
step and it fixes the tooltip issue. I still have the up/down arrow (they increment/decrement by 1).
Maybe offering the possibility to configure the step if people want to benefit from validation and precise increment/decrement could be a nice feature.
from json-schema-form.
Excellent. Feel free to create a PR for this.
As for being able to configure this, it could look like this:
{
"type": "number",
"step": 0.1
}
I personally feel like a default of 1 is sufficient. Imagine you're entering a number 12.5 in 0.1 increments. That's a lot of clicks...
from json-schema-form.
I created a PR for the support of step
. This is my first PR ever so please let me know If I need to change things or anything.
I didn't really find anywhere to document the step
attribute.
from json-schema-form.
Thanks so much for your PR and welcome to the team! I made a small change to reuse the multipleOf (https://json-schema.org/understanding-json-schema/reference/numeric.html#multiples) instead of introducing "step". Reading the reference you provided (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#step) it seems to me that this is the natural thing to do. This way, the example (https://dashjoin.github.io/#/example/multipleOf) also correctly increments by 11 and the form stays valid going from 88 to 99 etc.
from json-schema-form.
Great thank you! I didn't see the "multipleOf" applied to numbers, perfect use case.
Also thanks for this library :)
from json-schema-form.
Related Issues (20)
- array validation issue HOT 1
- Allow choicesUrl to include parts of the current JSON object
- More flexible tab layout
- Update to Angular 14 HOT 1
- Numeric autocomplete field shows NaN when input is empty
- Custom component interacting with the rest of the form
- Upload widget should retain file name
- Offer layouts for nested objects
- url format should support file: urls also
- Update to Angular 15 HOT 3
- Date Field Type HOT 3
- Offer the ability to change a default component
- Fix stackblitz
- implement the remaining features from the previous angular 14 version
- add peer dependencies
- Remove BrowserModule dep HOT 2
- Order property of schema is not taken into account
- fix readme
- Angular 17
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from json-schema-form.