This repository has been archived by the owner on Jul 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
eventsignupwithaddress.html
168 lines (153 loc) · 6.56 KB
/
eventsignupwithaddress.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
160
161
162
163
164
165
166
167
168
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>UGACSCF Sign Up Sheet</title>
<meta name="description" content="Sign Up Sheet">
<meta name="viewport" content="width=device-width">
<script type="text/javascript" src="js/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="js/parse-latest.js"></script>
<link rel="stylesheet" href="css/main.css" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
<script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<!--<script type="text/javascript" src="js/HeaderFooter.js"></script>-->
</head>
<body>
<div id="main">
<h1>UGACSCF Sign Up Sheet活动报名</h1>
<h3>活动详情:<div id="eventDetail">查看活动介绍</div></h3>
<br>
<form id="SignUpForm" method="post">
<div class="form-group">
<label for="fname">名字 First Name</label>
<input type="text" class="form-control" id="fname" placeholder="Jane">
</div>
<div class="form-group">
<label for="lname">姓氏 Last Name</label>
<input type="text" class="form-control" id="lname" placeholder="Doe">
</div>
<div class="form-group">
<label for="emailInput">Email地址 Email address</label>
<input type="email" class="form-control" id="emailInput" placeholder="Email">
</div>
<div class="form-group">
<label for="phoneInput">手机号码 Phone Number</label>
<input type="tel" class="form-control" id="phoneInput" placeholder="Email">
</div>
<div class="form-group">
<label for="pickupLocation">接送地址 Pick Up Location</label>
<select class="form-control" id="pickupSelect">
<option>Drive by myself 自行驾驶前往</option>
<option>Tate Parking Deck停车场入口</option>
<option>Riverbend Pkwy各大车站</option>
<option>Lakeside 入口</option>
<option>Family Housing 地带</option>
<option>ECV/Ramsey停车场</option>
<option>其他</option>
</select>
<textarea class="form-control" rows="3" id="pickupLocation" placeholder="无论选什么都请填写详细地址。Please fill in your address detail, no matter what you choose."></textarea>
</div>
<div class="form-group">
<label for="extraInput">备注 Other Comment:</label>
<textarea class="form-control" rows="3" id="extraInput" placeholder="其他任何事项(食物过敏等),请写在此。Any other information, please wrote it here."></textarea>
</div>
<button type="submit" id="signUpButton" class="btn btn-default">报名</button>
</form>
<div style="display:none" class="error">
<p>Looks like there was a problem with save. Try again.</p>
</div>
<div style="display:none" id="successbox" class="success">
<p>你已经成功报名了。</p>
<p>欢迎关注我们的官方微信号,扫描二维码:
<br><img src="img/weixin.jpg">
<br>如果您有任何疑问,请联系: <a href="mailto:webmaster@ugacscf.org">webmaster@ugacscf.org</a>
</p>
</div>
</div>
<script type="text/javascript">
Parse.initialize("zcsUN6L48qEuivCDRYVIRZMPbcAL3uXmidyCXhtH", "bZTUGGQ37ZMLvOp2baAxyHMirE4H0Kudz7fxMVqv");
var SignUpSheet = Parse.Object.extend("SignUpSheet");
var NewSignUpSheet = new SignUpSheet();
var signUpQuery = new Parse.Query(SignUpSheet);
var fnameParam = getQueryVariable('fname');
if (fnameParam != null) document.getElementById("fname").value = fnameParam;
var lnameParam = getQueryVariable('lname');
if (lnameParam != null) document.getElementById("lname").value = lnameParam;
var emailParam = getQueryVariable('email');
if (emailParam != null) document.getElementById("emailInput").value = emailParam;
var eventInfo = Parse.Object.extend("eventInfo");
var eventQuery = new Parse.Query(eventInfo);
var objectIdParam = getQueryVariable('id');
var eventRelated;
if (objectIdParam != null) {
document.getElementById("eventDetail").innerHTML = "<a href='eventinfo.html?id=" + objectIdParam.toString() + "'>查看活动介绍</a>";
eventQuery.get(objectIdParam, {
success: function(object) {
eventRelated = object;
//alert(eventRelated.id);
},
error: function(object, error) {
// The object was not retrieved successfully.
// error is a Parse.Error with an error code and message.
}
});
}
function getQueryVariable(variable) {
var query = window.location.search.substring(1);
var vars = query.split('&');
for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split('=');
if (decodeURIComponent(pair[0]) == variable) {
return decodeURIComponent(pair[1]);
}
}
console.log('Query variable %s not found', variable);
}
$('#SignUpForm').submit(function() {
SubmitParse();
return false;
});
function SubmitParse() {
//alert("start");
var fname = document.getElementById("fname").value;
var lname = document.getElementById("lname").value;
var emailInput = document.getElementById("emailInput").value;
var phoneInput = document.getElementById("phoneInput").value;
var pickupSelect_dg = document.getElementById("pickupSelect");
var pickupSelect_i = pickupSelect_dg.selectedIndex;
var pickupSelect = pickupSelect_dg.options[pickupSelect_i].text;
var pickupLocation = document.getElementById("pickupLocation").value;
//alert(eventRelated.id);
var extraInput = document.getElementById("extraInput").value;
NewSignUpSheet.save({
firstName: fname,
lastName: lname,
email: emailInput,
phone: phoneInput,
pickupSelect: pickupSelect,
pickupLocation: pickupLocation,
extraInput: extraInput,
eventRelated: eventRelated
}, {
success: function(object) {
$("#successbox").slideDown("slow");
document.getElementById("fname").disabled = true;
document.getElementById("lname").disabled = true;
document.getElementById("emailInput").disabled = true;
document.getElementById("phoneInput").disabled = true;
document.getElementById("pickupSelect").disabled = true;
document.getElementById("pickupLocation").disabled = true;
document.getElementById("extraInput").disabled = true;
alert("success");
},
error: function(model, error) {
$(".error").show();
alert(model.toString()+"<br/>"+error.toString());
}
});
};
</script>
</body>
<div id="footer" class="text-muted"></div>
</html>