-
Notifications
You must be signed in to change notification settings - Fork 0
/
Post Data to Spread.html
145 lines (116 loc) · 3.66 KB
/
Post Data to Spread.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
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<style>
body {font-family: Arial, Helvetica, sans-serif;}
form {border: 3px solid #f1f1f1;}
input[type=text], input[type=email], select {
width: 49%;
font-size:20px;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
box-sizing: border-box;
}
button {
background-color: #4CAF50;
color: white;
padding: 14px 20px;
margin: 8px 0;
border: none;
cursor: pointer;
width: 100%;
}
button:hover {
opacity: 0.8;
}
.cancelbtn {
width: auto;
padding: 10px 18px;
background-color: #f44336;
}
.imgcontainer {
text-align: center;
margin: 24px 0 12px 0;
}
img.avatar {
width: 20%;
border-radius: 50%;
}
.container {
padding: 16px;
}
span.psw {
float: right;
padding-top: 16px;
}
/* Change styles for span and cancel button on extra small screens */
@media screen and (max-width: 300px) {
span.psw {
display: block;
float: none;
}
.cancelbtn {
width: 100%;
}
}
</style>
</head>
<body style="background:#000;">
<center><h1 style="color:#fff">COVID-19 Workers Relief</h1></center>
<form id="form" target="_self" onsubmit="return postToGoogle();" action="" autocomplete="off">
<input id="nameField" name="entry.1050702730" placeholder="Enter your name" type="text" required>
<input id="emailField" name="entry.1719483374" placeholder="Enter your email" type="email" required>
<input id="mobField" name="entry.186554456" placeholder="Enter your 10 Digit Phone Number" type="text" pattern="^\d{10}$" required>
<input id="aadharField" name="entry.2013745445" placeholder="Enter your 12 Digit aadhaar number" type="text" required>
<button id="send" type="submit" class="common_btn">Register Now</button>
</form>
<h3 id="success-msg" style="text-align: center !important; margin-top:190px !important; display:none; color:#fff"> Your Request has been posted to Google Spreadsheet</h3>
<script>
function postToGoogle() {
var field1 = $("#nameField").val();
var field2 = $("#emailField").val();
var field3 = $("#mobField").val();
var field4 = $("#aadharField").val();
if(field1 == ""){
alert('Please Fill Your Name');
document.getElementById("nameField").focus();
return false;
}
if(field2 == ""){
alert('Please Fill Your Email');
document.getElementById("emailField").focus();
return false;
}
if(field3 == "" || field3.length > 10 || field3.length < 10){
alert('Please Fill Your Mobile Number');
document.getElementById("mobField").focus();
return false;
}
if(field4 == "" || field4.length > 12 || field4.length < 12){
alert('Please Fill Your Aadhar Number');
document.getElementById("mobField").focus();
return false;
}
$.ajax({
url: "https://docs.google.com/forms/d/e/1FAIpQLSdIH_wOB0-n10-PoL59Xe4gYF92DJGE857YPN_KjmS6F7GI1w/formResponse?",
data: {"entry.1050702730": field1, "entry.1719483374": field2, "entry.186554456": field3, "entry.2013745445": field4},
type: "POST",
dataType: "xml",
success: function(d)
{
},
error: function(x, y, z)
{
$('#success-msg').show();
$('#form').hide();
}
});
return false;
}
</script>
</body>
</html>