Comments (9)
Use the required
prop along with requiredError
. validationError
pairs with the prop validations
.
from formsy-material-ui.
Hi, thanks a lot for your great work and for read this. I'm a fraid that i don´t understand. Can you please give me a short sample?
from formsy-material-ui.
Instead of
validations={{ yourErrorName: (data, value) => return !!value }}
validationErrors={{ yourErrorName: 'Error message' }}
use
required={true}
requiredError={'Required error messsage'}
from formsy-material-ui.
This show a error:
Unknown prop
requiredError on <div> tag. Remove this prop from the element. For details, see https://fb.me/react-unknown-prop...
This is my code:
<FormsySelect
name="patientFound"
value={this.props.item.patientFound}
floatingLabelText="Fue encontrado *"
fullWidth={true}
onChange={this.handleChangedInput}
required={true}
requiredError={'Required error messsage'}
>
{this.state.patientFound.map((item, index) => <MenuItem key={index} value={item} primaryText={item} />)}
</FormsySelect>
from formsy-material-ui.
@rojobuffalo can you help me please? :(
from formsy-material-ui.
@aebmknrl The error you're seeing is just something we need to patch by deconstructing required
from props
. There are other vars deconstructed here: https://github.com/rojobuffalo/formsy-material-ui/blob/master/src/FormsySelect.jsx#L43, then ...rest
gets passed to the Material component. If we add required
there, it won't get passed through to a <div>
and that warning will go away.
Before we add that fix though, I want to be sure the required
and requiredError
behavior will work on this type of field. Is this error breaking your app or is it just putting a message in the console without any other side-effects? If no side-effects, is the form validation behaving as expected?
from formsy-material-ui.
@rojobuffalo Is not breaking the code, just a warning. The only strange thing that i see is this:
This field is mark as required...
Now, on Formsy.Form
component i have:
<Formsy.Form
name="patientEvaluation"
onValidSubmit={this.handleSubmitForm}
>
This form only will be submited if is valid... but, if i left my FormsySelect without any value, then the form is submited too. Very strange.
from formsy-material-ui.
@aebmknrl ok, good to know. It's possible that support for required
on a Select component was intentionally left off at one point. But I see no reason why we can't patch it. PRs welcome. I can't look at it right away, but will get around to it if no one submits a PR.
from formsy-material-ui.
Well... i would really like to help you with a PR, but i'm affraid that i will messed up your great code xD
I hope that you can help me with this soon. Please, don't forgett me @rojobuffalo. And thanks a lot for you attention.
from formsy-material-ui.
Related Issues (20)
- Is there a component for file upload? HOT 1
- FormsySelect onChange getting bypassed HOT 3
- Support the incoming Material UI v1.0 HOT 10
- Text field underline color broken after 0.6.1 HOT 10
- FormsyText with type="number" bad behavior HOT 3
- FormsyAutoComplete does not use provided default value HOT 2
- Remove FormsyAutoComplete component? HOT 1
- Warning: getDefaultProps
- FormsySelect does not change underline color when selected HOT 1
- Not working with React 16.1.1 HOT 1
- Support new Formsy
- Incorrect directory HOT 6
- Support formsy-react v1.1.2 HOT 4
- FormsyDate and FormsyTime don't handle value argument properly
- FormsyText cannot accept value 0
- Not compatible HOT 1
- not compatible with React 16.3.1 HOT 1
- Accept a list of validation errors?
- Is This Project Maintained? HOT 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 formsy-material-ui.