Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- React.createClass({
- getInitialState: function() {
- return {
- password: '123456',
- valid: true
- };
- },
- handleChange: function(se) {
- var confirmationValue = se.target.value;
- // Use the 'password' component reference to get the password input value
- // in order to perform the validation
- var valid = (this.refs.password.getValue() !== confirmationValue);
- this.setState({
- password: confirmationValue,
- valid: valid
- });
- },
- render: function() {
- return (
- <form>
- <Input
- type="text"
- defaultValue={ this.state.password }
- ref="password" />
- <Input
- type="text"
- value={ this.state.confirmation }
- onChange={ this.handleChange }
- bsStyle={ !this.state.valid ? 'error' : null } />
- </form>
- );
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement