forked from Puja-Saraf/h4i_team_31
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdonateform.html
159 lines (126 loc) · 5.39 KB
/
donateform.html
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<!DOCTYPE html>
<html>
<head>
<title>Donation Form</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lato">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
<!-- Start Contact Section -->
<div class="w3-container w3-light-grey w3-padding-32 w3-padding-large" id="contact">
<div class="w3-content" style="max-width:600px">
<h4 class="w3-center"><b>Contact Us</b></h4>
<script type="text/javascript">var submitted=false;</script>
<!--Update the URL for thank you page on form submit -->
<iframe name="hidden_iframe" id="hidden_iframe" style="display:none;"
onload="if(submitted) {window.location='https://puja-saraf.github.io/h4i_team_31/';}"></iframe>
<!-- Update the Google forms URL in action-->
<form action="https://docs.google.com/forms/u/0/d/e/1FAIpQLSdCTm3bQRPoJ1Hw4EEYkPFRFjeIvLjrzUG99eu2O1K_fmfi4A/formResponse" method="post" target="hidden_iframe" onsubmit="return validateForm(); ">
<div class="w3-section">
<label>Name</label>
<input class="w3-input w3-border" type="text" placeholder="Your Name" id="name" required name="entry.427534063">
</div>
<div class="w3-section">
<label>Email</label>
<input class="w3-input w3-border" type="text" placeholder="Email" id="email" required name="entry.2017024715">
</div>
<div class="w3-section">
<label>Phone</label>
<input class="w3-input w3-border" type="text" placeholder="Phone number" id="phone" required name="entry.990439592">
</div>
<div class="w3-section">
<label>Breed</label>
<input class="w3-input w3-border" type="text" placeholder="Breed" id="breed" required name="entry.1432984872">
</div>
<div class="w3-section">
<label>Location</label>
<input class="w3-input w3-border" type="text" placeholder="Location(city,state)" id="location" required name="entry.474633661">
</div>
<div class="w3-section">
<label>More info about Dog (optional)</label>
<input class="w3-input w3-border" type="text" placeholder="Description" id="info" name="entry.976511736">
</div>
<div class="w3-section">
<button class="w3-button w3-block w3-black w3-margin-bottom" type="submit">Submit</button>
</div>
</form>
</div>
</div>
<script type="text/javascript">
function validateName() {
var name = document.getElementById('name').value;
if(name.length == 0) {
alert("Name can't be blank") ;
return false;
}
if (!name.match(/^[a-zA-Z]{3,}(?: [a-zA-Z]+){0,2}$/)) {
alert("Please enter your correct name") ;//Validation Message
return false;
}
return true;
}
function validatePhone() {
var phone = document.getElementById('phone').value;
if(phone.length == 0) {
alert("Phone number can't be blank") ;//Validation Message
return false;
}
if(!phone.match(/^[0]?[789]\d{9}$/)) {
alert("Please enter a correct phone number") ;//Validation Message
return false;
}
return true;
}
function validateEmail () {
var email = document.getElementById('email').value;
if(email.length == 0) {
alert("Email can't be blank") ;//Validation Message
return false;
}
if(!email.match(/^[A-Za-z\._\-[0-9]*[@][A-Za-z]*[\.][a-z]{2,4}$/)) {
alert("Please enter a correct email address") ;//Validation Message
return false;
}
return true;
}
function validateBreed() {
var breed = document.getElementById('breed').value;
if(breed.length == 0) {
alert("Breed can't be blank") ;
return false;
}
if (!breed.match(/^[a-zA-Z]{3,}(?: [a-zA-Z]+){0,2}$/)) {
alert("Please enter correct breed") ;//Validation Message
return false;
}
return true;
}
function validateLocation() {
var location = document.getElementById('location').value;
if(location.length == 0) {
alert("Location can't be blank") ;
return false;
}
if (!location.match(/^[a-zA-Z]{3,}(?: [a-zA-Z]+){0,2}$/)) {
alert("Please enter correct location") ;//Validation Message
return false;
}
return true;
}
function validateForm() {
if (!validateName() || !validatePhone() || !validateEmail() || !validateBreed() || !validateLocation()) {
alert("Form not submitted");//Validation Message
return false;
}
else {
submitted=true;
return true;
}
}
</script>
<!-- End Contact Section -->
</body>
</html>