mirror of
https://github.com/danbulant/Portfolio
synced 2026-06-07 00:30:11 +00:00
fix: parent's email, telephone validation
This commit is contained in:
parent
326aef5483
commit
54752a50d3
1 changed files with 3 additions and 3 deletions
|
|
@ -71,7 +71,7 @@
|
||||||
gdpr: yup.boolean().oneOf([true]),
|
gdpr: yup.boolean().oneOf([true]),
|
||||||
candidate: yup.object().shape({
|
candidate: yup.object().shape({
|
||||||
name: yup.string().required(),
|
name: yup.string().required(),
|
||||||
surname: yup.string(),
|
surname: yup.string().required(),
|
||||||
email: yup.string().email().required(),
|
email: yup.string().email().required(),
|
||||||
telephone: yup
|
telephone: yup
|
||||||
.string()
|
.string()
|
||||||
|
|
@ -106,13 +106,13 @@
|
||||||
.string()
|
.string()
|
||||||
.email()
|
.email()
|
||||||
.test((_val, context) => {
|
.test((_val, context) => {
|
||||||
if (context.path.includes('parents[1]')) {
|
if (context.path.includes('parents[1]') && _val === '') {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return _val !== '';
|
return _val !== '';
|
||||||
}),
|
}),
|
||||||
telephone: yup.string().test((_val, context) => {
|
telephone: yup.string().test((_val, context) => {
|
||||||
if (context.path.includes('parents[1]')) {
|
if (context.path.includes('parents[1]') && _val === '') {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return _val?.match(/^\+\d{1,3} \d{3} \d{3} \d{3}$/) !== null;
|
return _val?.match(/^\+\d{1,3} \d{3} \d{3} \d{3}$/) !== null;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue