How I would I use this validation without reduxForm. I know how it is done with reduxForm but the guy above me wants this built without ReduxForm. So Any ideas on how to achieve this?
onAddHistory = (field) => (response, index, value) => {
const { history } = this.state;
console.log(this.state);
if (field === 'employerName' || field === 'description') {
history[field] = response.target.value;
} else if (field === 'roles') {
history[field] = value;
} else {
history[field] = response.value;
}
this.setState({
history: this.state.history,
}
}
isValid = () => {
const errors = {};
const regex = ***** to long to post
if (!history.employerName || Validator.isNull(history.employerName))
{errors.employerName = translations.translate('common',
'thisFieldIsRequired');}
this.setState({
errors,
});
return isEmpty(errors);
}
Then the errors would pass into the fields as Any ideas? Thank you ahead of time...
isValiddepends on how things are structured; I'd guess no, since that looks to be handling the response from an Ajax call, e.g., after the form has been submitted.