when select dropdown is focused, clear any validation errors

This commit is contained in:
Ben Wheeler 2019-09-16 22:34:32 -04:00
parent 303481b61d
commit 628e00f401
2 changed files with 13 additions and 2 deletions

View file

@ -84,7 +84,8 @@ class BirthDateStep extends React.Component {
const { const {
errors, errors,
handleSubmit, handleSubmit,
isSubmitting isSubmitting,
setFieldError
} = props; } = props;
return ( return (
<JoinFlowStep <JoinFlowStep
@ -118,6 +119,9 @@ class BirthDateStep extends React.Component {
'validation-birthdate-month', 'validation-birthdate-month',
'validation-left' 'validation-left'
)} )}
/* eslint-disable react/jsx-no-bind */
onFocus={() => setFieldError('birth_month', null)}
/* eslint-enable react/jsx-no-bind */
/> />
<FormikSelect <FormikSelect
className={classNames( className={classNames(
@ -131,6 +135,9 @@ class BirthDateStep extends React.Component {
options={birthYearOptions} options={birthYearOptions}
validate={this.validateSelect} validate={this.validateSelect}
validationClassName="validation-birthdate-year" validationClassName="validation-birthdate-year"
/* eslint-disable react/jsx-no-bind */
onFocus={() => setFieldError('birth_year', null)}
/* eslint-enable react/jsx-no-bind */
/> />
</div> </div>
<div className="join-flow-privacy-message"> <div className="join-flow-privacy-message">

View file

@ -64,7 +64,8 @@ class CountryStep extends React.Component {
const { const {
errors, errors,
handleSubmit, handleSubmit,
isSubmitting isSubmitting,
setFieldError
} = props; } = props;
return ( return (
<JoinFlowStep <JoinFlowStep
@ -93,6 +94,9 @@ class CountryStep extends React.Component {
options={this.countryOptions} options={this.countryOptions}
validate={this.validateSelect} validate={this.validateSelect}
validationClassName="validation-full-width-input" validationClassName="validation-full-width-input"
/* eslint-disable react/jsx-no-bind */
onFocus={() => setFieldError('country', null)}
/* eslint-enable react/jsx-no-bind */
/> />
{/* note that this is a hidden checkbox the user will never see */} {/* note that this is a hidden checkbox the user will never see */}
<FormikCheckbox <FormikCheckbox