diff --git a/src/common-components/AuthnValidationFormGroup.jsx b/src/common-components/AuthnValidationFormGroup.jsx index 909db75b..8084eba8 100644 --- a/src/common-components/AuthnValidationFormGroup.jsx +++ b/src/common-components/AuthnValidationFormGroup.jsx @@ -47,7 +47,7 @@ const AuthnCustomValidationFormGroup = (props) => { }; const showOptional = () => { const additionalField = props.optionalFieldCheckbox ? ( - ) : ; diff --git a/src/register/RegistrationPage.jsx b/src/register/RegistrationPage.jsx index c49bd738..1b64f858 100644 --- a/src/register/RegistrationPage.jsx +++ b/src/register/RegistrationPage.jsx @@ -487,7 +487,7 @@ class RegistrationPage extends React.Component { } return ( { let options = null; - let cssClass = 'mb-0'; + let cssClass = 'mb-20'; if (REGISTRATION_EXTRA_FIELDS.includes(field.name)) { if (!field.required && field.name !== 'honor_code' && field.name !== 'country') { REGISTRATION_OPTIONAL_MAP[field.name] = true; + const stateVar = camelCase(field.name); const props = { id: field.name, name: field.name, type: field.type, onChange: e => this.handleOnChange(e), + value: this.state[stateVar], }; if (field.type === 'select') { - options = field.options.map((item) => ({ - value: item.value, - label: item.name, - })); + options = field.options.map((item) => { + const option = {}; + option.value = item.value; + option.label = item.name; + if (item.name === '--') { + option.label = `${field.label} (optional)`; + option.disabled = true; + } + return option; + }); props.options = options; } if (field.name === 'gender') { @@ -540,16 +548,19 @@ class RegistrationPage extends React.Component { } return ( - - - - + onClick={(e) => this.handleOnClick(e)} + onChange={(e) => this.handleOnChange(e)} + selectOptions={props.options} + /> ); } } diff --git a/src/register/tests/__snapshots__/RegistrationPage.test.jsx.snap b/src/register/tests/__snapshots__/RegistrationPage.test.jsx.snap index f0347d8e..636c36b6 100644 --- a/src/register/tests/__snapshots__/RegistrationPage.test.jsx.snap +++ b/src/register/tests/__snapshots__/RegistrationPage.test.jsx.snap @@ -151,7 +151,7 @@ exports[`./RegistrationPage.js should display no password field when current pro value={false} />