Comments (7)
Doesn't that go against what we're seeing with HTML5 forms? Inputs are declaring their own validation rules through parameters (required, maxlength, etc).
The idea of being able to use an "EmailInput" and adding a required property to it and having it "just work" is alluring. Am I the only one? Would this be a benefit to you or your application?
from redux-form.
I would argue/suggest that the validation is "business" (not presentation) logic, and perhaps should not be done in the individual input component. I prefer input components that take a name
, label
, value
and error
message, and let the validator for the whole form perform the validation.
You can, of course, still use redux-form without the validation part, and do the validation separately, either on the fly, with onBlur
or onChange
, or later onSubmit
. By doing it in the component, no matter what, you're going to have to cycle through them to check isValid
before submitting, whether you use redux-form for the validation or not.
Don't know if that helps at all...?
from redux-form.
I agree with @erikras
from redux-form.
Yes, it does. And you should still use things like type="email"
in your inputs, primarily to inform mobile devices with software keyboards, however React bucks a lot of industry trends, such as controller/view separation and even stylesheets.
React trends, like stateless function components, are pushing in the opposite direction, taking away as much logic and state from the leaves of the "DOM" tree as possible.
I'm not denying that the old way of having a toolbox of smart components to handle your validation is/was not useful; I have built and used them myself, but we're at a bit of a philosophical impasse here. From my vantage point, I think it's the wise move to choose functional over OO (to cite another example) and dumb stateless components over smart stateful components when encountering such forks in the design road.
I'm not even sure what redux-form could do to make the job of a component-based validation system easier...provide some sort of registry for sub-components to check in with? What would that even look like?
this.context.registerValidation('name', value => value.length > 25 ? 'Too long' : true);
??
from redux-form.
We need this feature too. If you can provide #165 + get values function, that will be great.
from redux-form.
HTML5 validation is not currently supported (#254).
However, if your component accepts onBlur
, onFocus
and onChange
properties, it can mimic a native input and may be reusable.
from redux-form.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
from redux-form.
Related Issues (20)
- meat.error
- Redux Form 8.3.6 - Huge form Sluggish HOT 1
- Form submission canceled because the form is not connected.
- syncError is not recognizing unrecognized Fields
- Malicious code on api documentation site HOT 5
- Inline validate causing infinite loop (Maximum update depth exceeded)
- redux-form/examples HOT 4
- Using connect from react-redux with reduxForm HOC throws an error
- Radio field never gets touched with MUI - cannot validate
- how to select form value and put condition accordingly field array in redux form
- error UNSAFE_componentWillReceiveProps and UNSAFE_componentWillMount
- [Bug] : Redirect to Github link is broken
- Support React 18 HOT 9
- Multiple button needs reference in fieldArray onClick={() => fields.push({})}
- Scrollbar jumps on wizard example
- Support react-redux 8.x.x HOT 4
- validate does not trigger with new initialValues HOT 9
- Component mounts twice after going to different page from redux form
- Text characters are getting deleted in TextArea on iOS
- Security Vulnerability with Lodash version 4.17.15
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 redux-form.