Skip to content
Snippets Groups Projects
Commit ae7c0845 authored by Larbi Gharib's avatar Larbi Gharib
Browse files

Autocomplete create user

Change-Id: I4928b3d7a01a9fc0de9f9758ca81dc871679b658
parent 57bcc03c
No related branches found
No related tags found
No related merge requests found
import React from 'react'; import React from "react";
import PropTypes from 'prop-types'; import PropTypes from "prop-types";
import { ErrorMessage, Field } from 'formik'; import { ErrorMessage, Field } from "formik";
import FormControl from '@material-ui/core/FormControl'; import FormControl from "@material-ui/core/FormControl";
import InputLabel from "@material-ui/core/InputLabel"; import InputLabel from "@material-ui/core/InputLabel";
import Input from '@material-ui/core/Input'; import Input from "@material-ui/core/Input";
class FormikField extends React.Component { class FormikField extends React.Component {
render() { render() {
return ( return (
<div className="FormikField"> <div className="FormikField">
<FormControl size="medium" error={<ErrorMessage name={this.props.name} /> === ""} fullWidth> <FormControl
<InputLabel htmlFor={this.props.name}>{<ErrorMessage name={this.props.name} /> === "" ? this.props.label : <ErrorMessage name={this.props.name} />}</InputLabel> size="medium"
error={<ErrorMessage name={this.props.name} /> === ""}
fullWidth
>
<InputLabel htmlFor={this.props.name}>
{<ErrorMessage name={this.props.name} /> === "" ? (
this.props.label
) : (
<ErrorMessage name={this.props.name} />
)}
</InputLabel>
<Field <Field
placeholder={this.props.placeholder} placeholder={this.props.placeholder}
required={this.props.required} required={this.props.required}
...@@ -22,10 +32,11 @@ class FormikField extends React.Component { ...@@ -22,10 +32,11 @@ class FormikField extends React.Component {
label={this.props.label} label={this.props.label}
fullWidth fullWidth
type={this.props.type} type={this.props.type}
autoComplete={this.props.autoComplete}
/> />
</FormControl> </FormControl>
</div> </div>
) );
} }
} }
...@@ -36,7 +47,8 @@ FormikField.propTypes = { ...@@ -36,7 +47,8 @@ FormikField.propTypes = {
required: false, required: false,
name: PropTypes.string.isRequired, name: PropTypes.string.isRequired,
label: PropTypes.string.isRequired, label: PropTypes.string.isRequired,
type: "text" type: "text",
autoComplete: "on",
}; };
export default FormikField; export default FormikField;
...@@ -504,6 +504,7 @@ export default function EditCreateUserProfile(props) { ...@@ -504,6 +504,7 @@ export default function EditCreateUserProfile(props) {
</InputAdornment> </InputAdornment>
} }
required required
autoComplete="off"
/> />
</Grid> </Grid>
)} )}
...@@ -533,6 +534,7 @@ export default function EditCreateUserProfile(props) { ...@@ -533,6 +534,7 @@ export default function EditCreateUserProfile(props) {
</IconButton> </IconButton>
} }
required required
autoComplete="off"
/> />
</Grid> </Grid>
)} )}
...@@ -562,6 +564,7 @@ export default function EditCreateUserProfile(props) { ...@@ -562,6 +564,7 @@ export default function EditCreateUserProfile(props) {
</IconButton> </IconButton>
} }
required required
autoComplete="off"
/> />
</Grid> </Grid>
)} )}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment