Advertisement
Guest User

Untitled

a guest
Sep 2nd, 2015
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. React.createClass({
  2. getInitialState: function() {
  3. return {
  4. password: '123456',
  5. valid: true
  6. };
  7. },
  8.  
  9. handleChange: function(se) {
  10. var confirmationValue = se.target.value;
  11. // Use the 'password' component reference to get the password input value
  12. // in order to perform the validation
  13. var valid = (this.refs.password.getValue() !== confirmationValue);
  14. this.setState({
  15. password: confirmationValue,
  16. valid: valid
  17. });
  18. },
  19.  
  20. render: function() {
  21. return (
  22. <form>
  23. <Input
  24. type="text"
  25. defaultValue={ this.state.password }
  26. ref="password" />
  27. <Input
  28. type="text"
  29. value={ this.state.confirmation }
  30. onChange={ this.handleChange }
  31. bsStyle={ !this.state.valid ? 'error' : null } />
  32. </form>
  33. );
  34. }
  35. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement