Skip to content

Commit 9331093

Browse files
author
Finnian Anderson
committed
Add submit button and prettify
1 parent 3a1e869 commit 9331093

1 file changed

Lines changed: 35 additions & 22 deletions

File tree

pages/syllabus-choice.html

Lines changed: 35 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -49,26 +49,35 @@
4949
</nav>
5050
<div class="container">
5151
<div class="row" id="needs_margin_top">
52-
<div class="col-lg-10 col-lg-offset-1 col-md-10 col-md-offset-1 col-sm-10 col-sm-offset-1 col-xs-12" id="bodycontent" style="border-radius: 10px; padding-bottom: 15px;">
52+
<div class="col-lg-10 col-lg-offset-1 col-md-10 col-md-offset-1 col-sm-10 col-sm-offset-1 col-xs-12" id="bodycontent" style="border-radius: 10px;">
5353
<div class="row">
5454
<div class="col-lg-4 col-lg-offset-4 col-md-4 col-md-offset-4 col-sm-6 col-sm-offset-3 col-xs-8 col-xs-offset-2">
5555
<h1>Course selection</h1>
5656
<form>
57-
<label for="selectBoard">Board</label>
58-
<select id="selectBoard" name="course" class="form-control">
59-
<option value="CIE">CIE</option>
60-
<option class="disabled" value="Edexcel" disabled="disabled">Edexcel</option>
61-
<option class="disabled" value="AQA" disabled="disabled">AQA</option>
62-
<option class="disabled" value="OCR" disabled="disabled">OCR</option>
63-
</select>
64-
<label for="selectSubject">Subject</label>
65-
<select id="selectSubject" name="subject" class="form-control">
66-
<option disabled="" id="remove_subject">Loading...</option>
67-
</select>
68-
<label for="selectSyllabus">Syllabus</label>
69-
<select id="selectSyllabus" name="syllabus" class="form-control">
70-
<option disabled="" id="remove_syllabus">Loading...</option>
71-
</select>
57+
<div class="form-group">
58+
<label for="selectBoard">Board</label>
59+
<select id="selectBoard" name="course" class="form-control">
60+
<option value="CIE">CIE</option>
61+
<option class="disabled" value="Edexcel" disabled="disabled">Edexcel</option>
62+
<option class="disabled" value="AQA" disabled="disabled">AQA</option>
63+
<option class="disabled" value="OCR" disabled="disabled">OCR</option>
64+
</select>
65+
</div>
66+
<div class="form-group">
67+
<label for="selectSubject">Subject</label>
68+
<select id="selectSubject" name="subject" class="form-control">
69+
<option disabled="" id="remove_subject">Loading...</option>
70+
</select>
71+
</div>
72+
<div class="form-group">
73+
<label for="selectSyllabus">Syllabus</label>
74+
<select id="selectSyllabus" name="syllabus" class="form-control">
75+
<option disabled="" id="remove_syllabus">Loading...</option>
76+
</select>
77+
</div>
78+
<div class="form-group text-center">
79+
<button id="submit_btn" class="btn btn-primary">Generate questions</button>
80+
</div>
7281
</form>
7382
</div>
7483
</div>
@@ -122,7 +131,10 @@ <h1>Course selection</h1>
122131
});
123132
}
124133

134+
var data = [];
135+
125136
function goGetQuestion(i_n) {
137+
console.log("Submitting...");
126138
var examBoardBuffer = document.getElementById("selectBoard");
127139
var examBoard = examBoardBuffer.options[examBoardBuffer.selectedIndex].value;
128140

@@ -146,10 +158,13 @@ <h1>Course selection</h1>
146158
"subject": subject,
147159
"syllabus": syllabus,
148160
"url": i_n
149-
}).success(function(data) {
161+
}).success(function(newData) {
162+
data = newData;
150163
console.log(data);
164+
for (var i = 0; i < 5; i++){
165+
console.log(data[0][i]);
166+
}
151167
});
152-
// Oli: i_n = the url for the PDF - do with it what you want.
153168
}
154169

155170
$("#selectBoard").on("change", function() {
@@ -164,11 +179,9 @@ <h1>Course selection</h1>
164179
$("#selectSubject").on("click", function() {
165180
updateSyllabus($("#selectSubject").find(":selected").attr("value"));
166181
});
167-
$("#selectSyllabus").on("click", function() {
168-
goGetQuestion($("#selectSyllabus").find(":selected").attr("value"));
169-
});
170-
$("#selectSyllabus").on("change", function() {
182+
$("#submit_btn").on("click", function() {
171183
goGetQuestion($("#selectSyllabus").find(":selected").attr("value"));
184+
return false;
172185
});
173186
</script>
174187
</html>

0 commit comments

Comments
 (0)