-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for ref's on Input component #2
Comments
Hi @mwq27 - I'm not able to reproduce the issue you're referring to. I was able to do that following: /**
* @jsx React.DOM
*/
var React = require('react'),
mui = require('material-ui');
var myComponent = React.createClass({
componentDidMount: function() {
console.log(this.refs.firstname.getDOMNode());
},
render: function() {
return (
<mui.Input ref="firstname" type="text" name="firstname" placeholder="First Name" description="Your first name as it appears on your credit card." />
);
}
});
module.exports = MyComponent; |
So I have
that is returning undefined, even after I add text to the input. this.refs.firstname.getDOMNode() by itself is the div that gets created in Input.jsx, so I guess it wouldn't have a .value property. |
Ahh yes. You're right. I've updated the input component to handle this. Now you can do: render: function() {
return (
<mui.Input ref="firstname" defaultValue="Test" onChange={this._onChange} />
);
},
//onChange now passes back the new value as a second parameter
_onChange: function(e, value) {
console.log(value);
//Or you can do this elsewhere in your component
console.log(this.refs.firstname.getValue());
} |
ok great, thank you :) |
[Chip] Add more tests, change Avatar type checking for more flexibili…
modalManager and space after colon linting
Add a callback property that is called whenever the MenuItem focus is changed. Sometimes it will be called when the focus isn't changed. For example: * If top menu item is keyboard focused (call mui#1) and then the up arrow is pressed (call mui#2). * If some menu item is keyboard focused (call mui#1) and then that same menu item is clicked (call mui#2).
# This is the 1st commit message: [docs] load Jarle preview, simple-react-code-editor on static demo click # This is the commit message mui#2: show full source with edited changes
links weren't linking to correct anchors. Fixed and updated name of mui#2 from "reusable style overrides" to "reusable component"
I'm not able to set a ref attribute on the Input component.
The text was updated successfully, but these errors were encountered: