Comments (3)
I found a quick fix in this file:
Instead of pushing all differentes states for one input, push only one state for one input (ordered by priority).
from:
if (field.hasErrors()) states.push('hasErrors');
if (field.hasWarnings()) states.push('hasWarnings');
if (field.hasInfos()) states.push('hasInfos');
if (field.isValid()) states.push('isValid');
to:
if (field.hasErrors()) states.push('hasErrors');
else if (field.hasWarnings()) states.push('hasWarnings');
else if (field.hasInfos()) states.push('hasInfos');
else if (field.isValid()) states.push('isValid');
PS: 'is-valid'
class is not added if input has errors, warnings or infos
from react-form-with-constraints.
Sorry for the delay, I'm AFK until mid december.
An input can have warnings and/or infos and still be valid. Ce n'est pas exclusif.
hasErrors state is the only invalid state, others (info, warning) are considered valid. You can override the CSS if you want a different styling.
Here the related Sass code source: https://github.com/tkrotoff/react-form-with-constraints/blob/v0.14.0/packages/react-form-with-constraints-bootstrap4/scss/bootstrap.scss#L143-L150
Je pense que dans ton exemple le "wording" des feedbacks n'est pas le bon et devrait être :
- hasErrors/invalid CSS class : "Cette information est incorrecte"
- hasWarnings/warning CSS class : "Vérifiez cette information, elle semble/est peut être incorrecte"
- hasInfos/info CSS class : "pour information blabla"
from react-form-with-constraints.
Overriding CSS will be the easiest solution thx!
from react-form-with-constraints.
Related Issues (20)
- Use webpack tree shaking HOT 1
- Rename username to email in the examples HOT 1
- Remove TSLint HOT 1
- Required field validation does not work properly with class-based components HOT 2
- Rework examples/PlainOldReact?
- Show something while a field is untouched, when dirty replace by feedbacks HOT 2
- Returns HTMLElement in Field HOT 1
- Return the input state and form state using hooks HOT 1
- Crash "Can't perform a React state update on an unmounted component"
- lib/ never seems to be used, only lib-es5/ HOT 1
- componentWillMount is deprecated HOT 1
- Use Array.flat(Infinity)?
- In .vscode/launch.json, replace workspaceRoot by workspaceFolder HOT 1
- Remove IE 10 support
- "Multiple elements matching 'name' inside the form" error HOT 1
- Async await on emitEvent HOT 1
- Validation errors not disappearing HOT 1
- Add unit tests to examples Bootstrap4 and Password
- Form with constraints components dont work with react 18 HOT 5
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 react-form-with-constraints.