Skip to content

Commit

Permalink
Update script.js
Browse files Browse the repository at this point in the history
  • Loading branch information
BradleySchapf committed Dec 14, 2023
1 parent 946e6d6 commit f0ade90
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,21 @@ function formHasErrors() {
}
}

let regex = new RegExp(/^\d{10}$/);
let phoneNumValue = document.getElementById("phone").value;

if(!regex.test(phoneNumValue)) {
document.getElementById("phone_error").style.display = "block";

if(!errorFlag){
document.getElementById("phone").focus();
document.getElementById("student").select();

}

errorFlag = true;
}

return errorFlag;
}

Expand Down

0 comments on commit f0ade90

Please sign in to comment.