|
|
@@ -113,6 +113,7 @@ const CustomFormWizard = (props) => { |
|
|
|
const [checkIdDocHKIDNumberBlur, setCheckIdDocHKIDNumberBlur] = useState(false) |
|
|
|
const [checkDigit, setCheckDigit] = useState(document.getElementById("checkDigit-login")) |
|
|
|
const [checkCheckDigitBlur, setCheckCheckDigitBlur] = useState(false) |
|
|
|
const [checkHKIdDocWithCheckDigit, setCheckHKIdDocWithCheckDigit] = useState(false) |
|
|
|
const email = document.getElementById("email-login") |
|
|
|
const [checkEmail, setCheckEmail] = useState(false) |
|
|
|
const [checkEmailBlur, setCheckEmailBlur] = useState(false) |
|
|
@@ -553,7 +554,12 @@ const CustomFormWizard = (props) => { |
|
|
|
// } |
|
|
|
switch (selectedIdDocType) { |
|
|
|
case "HKID": |
|
|
|
if (checkDigit === "") return false |
|
|
|
if (checkDigit === ""){ |
|
|
|
setCheckHKIdDocWithCheckDigit(true) |
|
|
|
return false |
|
|
|
} else{ |
|
|
|
setCheckHKIdDocWithCheckDigit(false) |
|
|
|
} |
|
|
|
if (idNo.match(pattern_HKIDv1)) { |
|
|
|
return true |
|
|
|
} else if (idNo.match(pattern_HKIDv2)) { |
|
|
@@ -701,7 +707,7 @@ const CustomFormWizard = (props) => { |
|
|
|
idNo: yup.string().required(getRequiredErrStr('number')) |
|
|
|
.matches(/^[aA-zZ0-9\s]+$/, { message: displayErrorMsg(`${selectedIdDocInputType}${intl.formatMessage({ id: 'noSpecialCharacter' })}`) }) |
|
|
|
.matches(/^\S*$/, { message: displayErrorMsg(`${selectedIdDocInputType}${intl.formatMessage({ id: 'noSpace' })}`) }) |
|
|
|
.test('checkIDCardFormat', displayErrorMsg(`${intl.formatMessage({ id: 'requiredValid' })}${selectedIdDocInputType}${intl.formatMessage({ id: 'number' })}`), function (value) { |
|
|
|
.test('checkIDCardFormat', displayErrorMsg(`${intl.formatMessage({ id: 'requiredValid' })}${selectedIdDocInputType==undefined?"":selectedIdDocInputType}${intl.formatMessage({ id: 'number' })}`), function (value) { |
|
|
|
const idDocType = selectedIdDocType.type; |
|
|
|
var pattern_HKIDv1 = /^[A-Z]{1}[0-9]{6}$/; |
|
|
|
var pattern_HKIDv2 = /^[A-Z]{2}[0-9]{6}$/; |
|
|
@@ -1085,7 +1091,7 @@ const CustomFormWizard = (props) => { |
|
|
|
placeholder={intl.formatMessage({ id: 'idDocNumber' })} |
|
|
|
fullWidth |
|
|
|
sx={{ mr: 1 }} |
|
|
|
error={Boolean(formik.touched.idNo && formik.errors.idNo && checkIdDocNumber)} |
|
|
|
error={Boolean(formik.touched.idNo && formik.errors.idNo && checkIdDocNumber && checkHKIdDocWithCheckDigit)} |
|
|
|
onBlur={formik.handleBlur} |
|
|
|
inputProps={{ |
|
|
|
maxLength: selectedIdDocType.type === 'HKID' ? 8 : 18, |
|
|
@@ -1109,7 +1115,12 @@ const CustomFormWizard = (props) => { |
|
|
|
)} |
|
|
|
{checkIdDocNumber && ( |
|
|
|
<FormHelperText error id="helper-text-idNo-signup"> |
|
|
|
<FormattedMessage id="usernameTaken" /> |
|
|
|
<FormattedMessage id="idNoTaken" /> |
|
|
|
</FormHelperText> |
|
|
|
)} |
|
|
|
{checkHKIdDocWithCheckDigit && ( |
|
|
|
<FormHelperText error id="helper-text-idNo-checkdigit-signup"> |
|
|
|
<FormattedMessage id="requiredNumberInQuote" /> |
|
|
|
</FormHelperText> |
|
|
|
)} |
|
|
|
</Stack> |
|
|
@@ -1188,7 +1199,7 @@ const CustomFormWizard = (props) => { |
|
|
|
)} |
|
|
|
{checkIdDocNumber && ( |
|
|
|
<FormHelperText error id="helper-text-idNo-signup"> |
|
|
|
<FormattedMessage id="usernameTaken" /> |
|
|
|
<FormattedMessage id="idNoTaken" /> |
|
|
|
</FormHelperText> |
|
|
|
)} |
|
|
|
</Stack> |
|
|
|