-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvalidation.js
79 lines (61 loc) · 2.26 KB
/
validation.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
"use strict";
function validateContact() {
var apname=document.getElementById("apname").value;
var apemail=document.getElementById("apemail").value;
var aptel=document.getElementById("aptel").value;
var apdate=document.getElementById("apdate").value;
var apcomment=document.getElementById("apcomment").value;
if(apname=="" || apemail=="" || aptel=="" || apdate=="" || apcomment==""){
document.getElementById("ferror").innerHTML = "Please Fill all fields";
return false;
}
else{
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(apemail))
{
return (true);
}
document.getElementById("ferror").innerHTML = "You have entered an invalid email address!";
return (false);
}
}
function validateContact1() {
var apemail=document.getElementById("apemail").value;
var aptel=document.getElementById("aptel").value;
var apcomment=document.getElementById("apcomment").value;
var country_id=document.getElementById("country_id").value;
var checkb=document.getElementById("squaredOne").value;
var apfname = document.getElementById("apfname").value;
var aplname = document.getElementById("aplname").value;
var apdate = document.getElementById("apdate").value;
var apdob = document.getElementById("apdob").value;
if( apemail=="" || aptel=="" || apcomment=="" || country_id=="" || checkb.length<=3 || apfname=="" || aplname=="" || apdate=="" || apdob==""){
document.getElementById("ferror").innerHTML = "Please Fill all fields";
return false;
}
else{
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(apemail))
{
return (true);
}
document.getElementById("ferror").innerHTML = "You have entered an invalid email address!";
return (false);
}
}
function validateContactpage() {
var apname=document.getElementById("apname").value;
var apemail=document.getElementById("apemail").value;
var aptel=document.getElementById("aptel").value;
var apcomment=document.getElementById("apcomment").value;
if(apname=="" || apemail=="" || aptel=="" || apcomment==""){
document.getElementById("ferror").innerHTML = "Please Fill all fields";
return false;
}
else{
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(apemail))
{
return (true);
}
document.getElementById("ferror").innerHTML = "You have entered an invalid email address!";
return (false);
}
}