diff --git a/api/QCVOC.Api/Veterans/Data/DTO/VeteranEnrollRequest.cs b/api/QCVOC.Api/Veterans/Data/DTO/VeteranEnrollRequest.cs index 02073ab7..153357e4 100644 --- a/api/QCVOC.Api/Veterans/Data/DTO/VeteranEnrollRequest.cs +++ b/api/QCVOC.Api/Veterans/Data/DTO/VeteranEnrollRequest.cs @@ -49,7 +49,7 @@ public class VeteranEnrollRequest /// Gets or sets the primary phone number of the Veteran. /// [Required] - [Phone] + [RegularExpression(@"^[1-9][0-9]{9}$")] public string PrimaryPhone { get; set; } /// diff --git a/api/QCVOC.Api/Veterans/Data/DTO/VeteranUpdateRequest.cs b/api/QCVOC.Api/Veterans/Data/DTO/VeteranUpdateRequest.cs index 78b4ecc5..6d8254a4 100644 --- a/api/QCVOC.Api/Veterans/Data/DTO/VeteranUpdateRequest.cs +++ b/api/QCVOC.Api/Veterans/Data/DTO/VeteranUpdateRequest.cs @@ -49,7 +49,7 @@ public class VeteranUpdateRequest /// Gets or sets the primary phone number of the Veteran. /// [Required] - [Phone] + [RegularExpression(@"^[1-9][0-9]{9}$")] public string PrimaryPhone { get; set; } /// diff --git a/web/src/util.js b/web/src/util.js index 8ee093ed..5a1b3984 100644 --- a/web/src/util.js +++ b/web/src/util.js @@ -50,7 +50,7 @@ export const validateEmail = (email) => { export const validatePhoneNumber = (phoneNumber) => { // eslint-disable-next-line - var re = /\(\d{3}\) \d{3}-\d{4}/; + var re = /^[1-9][0-9]{9}$/; return re.test(phoneNumber); } diff --git a/web/src/veterans/VeteranDialog.js b/web/src/veterans/VeteranDialog.js index a8e4403f..72f22fdd 100644 --- a/web/src/veterans/VeteranDialog.js +++ b/web/src/veterans/VeteranDialog.js @@ -227,7 +227,7 @@ class VeteranDialog extends Component { result.primaryPhone = 'The Primary Phone field is required.'; } else if (!validatePhoneNumber(primaryPhone)) { - result.primaryPhone = 'Enter a valid phone number in the format (555) 555-5555.'; + result.primaryPhone = 'Enter a valid phone number in the format \'555555555\''; } if ((email !== '' && email !== undefined) && !validateEmail(email)) {