Don’t validate username server side if error

Fixes #1097 by not making the server-side username validation call if the client side validations have failed. This is not the ideal way to do this, since it’s getting the input from an array. However, to make this different would require significant refactor.
This commit is contained in:
Matthew Taylor 2016-12-28 09:54:46 -05:00
parent e763f8a9bf
commit 5da9514f4d

View file

@ -136,7 +136,9 @@ module.exports = {
}.bind(this));
},
onUsernameBlur: function (event) {
this.validateUsername(event.currentTarget.value);
if (this.refs.form.refs.formsy.inputs[0].isValidValue(event.currentTarget.value)) {
this.validateUsername(event.currentTarget.value);
}
},
onValidSubmit: function (formData) {
this.setState({waiting: true});
@ -183,6 +185,7 @@ module.exports = {
<Input className={this.state.validUsername}
type="text"
name="user.username"
ref="thing"
onBlur={this.onUsernameBlur}
validations={{
matchRegexp: /^[\w-]*$/,