-
Notifications
You must be signed in to change notification settings - Fork 0
/
wc_entry.html
executable file
·123 lines (98 loc) · 3.63 KB
/
wc_entry.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
<!doctype html>
<head>
<meta charset="utf-8">
<title>Word Cloud Entry</title>
<meta name="description" content="Word Cloud Generator">
<meta author="Peter Worthy" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/reset.css">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link rel="shortcut icon" href="../../assets/ico/favicon.ico">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script type="text/javascript" src="http://www.parsecdn.com/js/parse-1.2.18.min.js"></script>
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Word Cloud Generator</a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</div><!--/.nav-collapse -->
</div>
</div>
<div class="container">
<div id="main">
<p><br><br><br></p>
<p>Please select the question that you are responding to, enter your response and click submit.</p>
</div>
<div id="text_entry_input">
<p><input type="radio" id="Q_1" name="days" value="Question 1"> Question 1<br>
<input type="radio" id="Q_2" name="days" value="Question 2"> Question 2<br>
<input type="radio" id="Q_3" name="days" value="Question 3"> Question 3<br>
<input type="radio" id="Q_4" name="days" value="Question 4"> Question 4<br>
</p>
<form id="submit_text">
<p>
<textarea name="text" id="textentry" rows="3" cols="50"></textarea>
</p>
<p>
<input type="submit" value="Post your response">
</p>
</form>
</div>
<script type="text/javascript">
jQuery(document).ready(function($) {
Parse.initialize("0fDoU3tixdDTgs3iGWxjWdsbN8EsyjE6wFwtMy7j", "CQTCCMfGXwyPbukMSAoawLCxemrcqor6urIypgCs");
$("#submit_text").on("submit",function(e){
e.preventDefault();
var question_no = "";
if (document.getElementById('Q_1').checked) {
var question_no = "q1";
};
if (document.getElementById('Q_2').checked) {
var question_no = "q2";
};
if (document.getElementById('Q_3').checked) {
var question_no = "q3";
};
if (document.getElementById('Q_4').checked) {
var question_no = "q4";
};
console.log("question selected is "+question_no);
if (question_no == "") {
alert("A question has not been selected. Please select a question");
} else {
var ftextentry = $("#textentry").val();
console.log(ftextentry);
var ResponseText = Parse.Object.extend("ResponseText");
var responseText = new ResponseText();
responseText.set("course", "SPMD3052");
responseText.set("qid", question_no);
responseText.set("text",ftextentry);
responseText.save(null, {
success: function(responseText) {
console.log("New response with objectID: " + responseText.id);
alert("Your response has been posted");
},
error: function(responseText, error) {
alert("Failed to create new object, with error code: " + error.description);
}
});
};
});
});
</script>
</body>
</html>