| @@ -194,8 +194,9 @@ const CustomFormWizard = (props) => { | |||||
| data.password == data.confirmPassword && | data.password == data.confirmPassword && | ||||
| selectedIdDocType.type !== "" && | selectedIdDocType.type !== "" && | ||||
| data.idNo !== "" && | data.idNo !== "" && | ||||
| (data.enName !== "" || selectedIdDocType.type === "CNID") && | |||||
| data.chName !== "" && | |||||
| // (data.enName !== "" || selectedIdDocType.type === "CNID") && | |||||
| // data.chName !== "" && | |||||
| handleName(data.enName, data.chName) && | |||||
| data.address1 !== "" && | data.address1 !== "" && | ||||
| data.email !== "" && | data.email !== "" && | ||||
| data.emailConfirm !== "" && | data.emailConfirm !== "" && | ||||
| @@ -509,6 +510,17 @@ const CustomFormWizard = (props) => { | |||||
| } | } | ||||
| } | } | ||||
| function handleName(enName, chName) { | |||||
| if (enName == "" && chName !== ""){ | |||||
| return true | |||||
| } else if (enName !== "" && chName == ""){ | |||||
| return true | |||||
| } else { | |||||
| return false | |||||
| } | |||||
| } | |||||
| function handlePassword(password) { | function handlePassword(password) { | ||||
| let new_pass = password; | let new_pass = password; | ||||
| // regular expressions to validate password | // regular expressions to validate password | ||||
| @@ -589,11 +601,12 @@ const CustomFormWizard = (props) => { | |||||
| .matches(/^(?=.*[0-9])/, { message: displayErrorMsg(intl.formatMessage({ id: 'atLeast1Number' })) }) | .matches(/^(?=.*[0-9])/, { message: displayErrorMsg(intl.formatMessage({ id: 'atLeast1Number' })) }) | ||||
| .matches(/^(?=.*[!@#%&])/, { message: displayErrorMsg(intl.formatMessage({ id: 'atLeast1SpecialChar' })) }), | .matches(/^(?=.*[!@#%&])/, { message: displayErrorMsg(intl.formatMessage({ id: 'atLeast1SpecialChar' })) }), | ||||
| confirmPassword: yup.string().min(8, displayErrorMsg(intl.formatMessage({ id: 'atLeast8CharPassword' }))).required(displayErrorMsg(intl.formatMessage({ id: 'pleaseConfirmPassword' }))).oneOf([yup.ref('password'), null], displayErrorMsg(intl.formatMessage({ id: 'samePassword' }))), | confirmPassword: yup.string().min(8, displayErrorMsg(intl.formatMessage({ id: 'atLeast8CharPassword' }))).required(displayErrorMsg(intl.formatMessage({ id: 'pleaseConfirmPassword' }))).oneOf([yup.ref('password'), null], displayErrorMsg(intl.formatMessage({ id: 'samePassword' }))), | ||||
| enName: yup.string().max(40, getMaxErrStr(40)), | |||||
| chName: yup.string().max(6, getMaxErrStr(6)).when('enName', { | |||||
| is: (enName) => enName?false:true, | |||||
| then: yup.string().required(displayErrorMsg(intl.formatMessage({ id: 'userRequireChineseName' }))) | |||||
| }), | |||||
| chName: yup.string().max(6, getMaxErrStr(6)), | |||||
| enName: yup.string().max(40, getMaxErrStr(40)).when('chName', { | |||||
| is: (chName) => chName?false:true, | |||||
| then: yup.string().required(displayErrorMsg(intl.formatMessage({ id: 'registerNameLabel' }))) | |||||
| }), | |||||
| address1: yup.string().max(40, getMaxErrStr(40, "addressLine1")).required(displayErrorMsg(intl.formatMessage({ id: 'validateAddressLine1' }))), | address1: yup.string().max(40, getMaxErrStr(40, "addressLine1")).required(displayErrorMsg(intl.formatMessage({ id: 'validateAddressLine1' }))), | ||||
| address2: yup.string().max(40, getMaxErrStr(40, "addressLine2")), | address2: yup.string().max(40, getMaxErrStr(40, "addressLine2")), | ||||
| address3: yup.string().max(40, getMaxErrStr(40, "addressLine3")), | address3: yup.string().max(40, getMaxErrStr(40, "addressLine3")), | ||||