-
Notifications
You must be signed in to change notification settings - Fork 0
/
below_image.js
30 lines (22 loc) · 894 Bytes
/
below_image.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
function validateForm(){
var name = document.getElementById("name").value;
var email = document.getElementById("email").value;
var phonenumber = document.getElementById("phone").value;
var isvalid = true;
if (name == "") {
document.getElementById("nameError").innerHTML = "Name is required";
isValid = false;
} else if (name.length < 2 || name.length > 50) {
document.getElementById("nameError").innerHTML = "Name must be between 2 and 50 characters long";
isValid = false;
} else {
document.getElementById("nameError").innerHTML = "";
}
if (email == "") {
document.getElementById("emailError").innerHTML = "Email is required";
isValid = false;
} else {
document.getElementById("emailError").innerHTML = "";
}
return isvalid;
}