Giter Club home page Giter Club logo

Comments (9)

ryanblakeley avatar ryanblakeley commented on August 20, 2024 1

Use the required prop along with requiredError. validationError pairs with the prop validations.

from formsy-material-ui.

alienriquebm avatar alienriquebm commented on August 20, 2024

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.

ryanblakeley avatar ryanblakeley commented on August 20, 2024

Instead of

validations={{ yourErrorName: (data, value) => return !!value }}
validationErrors={{ yourErrorName: 'Error message' }}

use

required={true}
requiredError={'Required error messsage'}

from formsy-material-ui.

alienriquebm avatar alienriquebm commented on August 20, 2024

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.

alienriquebm avatar alienriquebm commented on August 20, 2024

@rojobuffalo can you help me please? :(

from formsy-material-ui.

ryanblakeley avatar ryanblakeley commented on August 20, 2024

@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.

alienriquebm avatar alienriquebm commented on August 20, 2024

@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.

ryanblakeley avatar ryanblakeley commented on August 20, 2024

@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.

alienriquebm avatar alienriquebm commented on August 20, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.