Comments (6)
You can't. See below code for supported props for FormsyText
propTypes: {
name: React.PropTypes.string.isRequired,
value: React.PropTypes.string
},
I tackled this problem by assigning a change handler to form like this:
<Formsy.Form
ref="form"
onValid={this.enableButton}
onInvalid={this.disableButton}
onValidSubmit={this.submitForm}
onChange={this.formChange}>
And get the value of changed field like this
/* In this particular case I am checking the value of field name */
formChange: function (event) {
if (typeof event.target !== 'undefined' && event.target.name === 'mobile') {
this.setState({
isMobileValid: /^[789]\d{9}$/.test(event.target.value)
});
}
},
from formsy-material-ui.
@lethanhquang - what Vijay said. :)
I guess we could rearrange the order to allow you to reassign onChange, but to be honest, at that point it pretty much defeats the purpose of using formsy-material-ui, and you might was well wrote your own wrapper.
Thinking about it we could add an onChange callback to each FMUI component itself to bubble that up from the underlying MUI component if there was enough demand for that feature. What is your use case?
from formsy-material-ui.
@vijayrawatsan: Thank you so much.
@mbrookes: In my case, I would like to reformat the currency number after the FormsyTextComponent has changed. But I think vijayrawatsan's solution is worked for me.
Than you guys!
from formsy-material-ui.
Thanks for letting us know. I'll keep this open for now in case others need this - both to expose Vijay's solution, and in consideration of adding this at a component level in the future.
from formsy-material-ui.
I think it doesn't cost much to add an onChange prop in each FMUI component (and similar thing for all the other events callback) and expose it thru the handleChange method of each FMUI component. It'd be a good idea to add these. Make the wrapper flexible and complete.
from formsy-material-ui.
I'd be cool with onChange
, but so much of the rest of the material-ui API is in flux, I'd be reluctant to introduce much else, lest it all gets deprecated.
Feel free to post a PR for that much at least. 👍
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
- FormsySelect required is not showing any error when submit the form HOT 9
- 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.