Skip to content

Commit

Permalink
Merge pull request #537 from ita-social-projects/#535-RegistrationFix…
Browse files Browse the repository at this point in the history
…BugWithBusinessEntityCheckboxes

#535 [Registration] Fix bug with business entity checkboxes
  • Loading branch information
Lvyshnevska authored Apr 19, 2024
2 parents d3829c5 + f44eeb7 commit 2666177
Showing 1 changed file with 5 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,10 @@ export function SignUpFormContentComponent(props) {
};

const onChangeCheckbox = (event) => {
const { name } = event.target;
if (name === 'yurosoba') {
setValue('fop', false);
} else if (name === 'fop') {
setValue('yurosoba', false);
}
const { name, checked } = event.target;
setValue(name, checked);
const otherOption = name === 'yurosoba' ? 'fop' : 'yurosoba';
setValue(otherOption, false);
if (!getValues('yurosoba') && !getValues('fop')) {
setError('businessEntity', { type: 'manual', message: errorMessageTemplates.required });
} else {
Expand All @@ -92,7 +90,7 @@ export function SignUpFormContentComponent(props) {
name: getValues('companyName'),
is_registered: (getValues('representative').indexOf('company') > -1),
is_startup: (getValues('representative').indexOf('startup') > -1),
is_fop: (getValues('fop').indexOf('fop') > -1),
is_fop: (getValues('fop')),
},
};

Expand Down Expand Up @@ -395,8 +393,6 @@ export function SignUpFormContentComponent(props) {
>
<input
type="checkbox"
name="yurosoba"
value={'yurosoba'}
{...register('yurosoba', {
onChange: onChangeCheckbox
})}
Expand All @@ -414,8 +410,6 @@ export function SignUpFormContentComponent(props) {
>
<input
type="checkbox"
name="fop"
value={'fop'}
{...register('fop', {
onChange: onChangeCheckbox
})}
Expand Down

0 comments on commit 2666177

Please sign in to comment.