Adds errors on field when not validated.

This commit is contained in:
gaba
2017-02-01 12:34:02 -08:00
parent 990685f17a
commit ee0bb50dd5
3 changed files with 6 additions and 8 deletions
@@ -28,6 +28,7 @@ const CreateDisplayNameDialog = ({open, handleClose, offset, formData, handleSub
<p>{lang.t('createdisplay.yourusername')}</p>
{ props.auth.error && <Alert>{props.auth.error}</Alert> }
<form id="saveDisplayName" onSubmit={handleSubmitDisplayName}>
{ props.errors.displayName && <span className={styles.hint}> {lang.t('createdisplay.specialCharacters')} </span> }
<FormField
id="displayName"
type="string"
@@ -38,12 +38,6 @@ class ChangeDisplayNameContainer extends Component {
componentDidMount() {
window.authCallback = this.props.facebookCallback;
const {formData} = this.state;
const errors = Object.keys(formData).reduce((map, prop) => {
map[prop] = lang.t('createdisplay.requiredField');
return map;
}, {});
this.setState({errors});
}
handleChange(e) {
+5 -2
View File
@@ -11,7 +11,8 @@
"save": "Save",
"requiredField": "Required field",
"errorCreate": "Error when changing display name",
"checkTheForm": "Invalid Form. Please, check the fields"
"checkTheForm": "Invalid Form. Please, check the fields",
"specialCharacters": "Display names can contain letters, numbers and _ only"
},
"error": {
"emailNotVerified": "Email address {0} not verified.",
@@ -42,7 +43,9 @@
"displayName": "Nombre a mostrar",
"save": "Guardar",
"requiredField": "Campo necesario",
"checkTheForm": "Formulario Invalido. Por favor, verifica los campos"
"errorCreate": "Hubo un error al cambiar el nombre de usuario",
"checkTheForm": "Formulario Invalido. Por favor, verifica los campos",
"specialCharacters": "Sólo pueden contener letras, números y _"
},
"error": {
"emailNotVerified": "Dirección de correo electrónico {0} no verificada.",