This commit is contained in:
Ross
2021-12-11 22:00:21 +00:00
parent 89985846d9
commit d996ad992f
+17 -17
View File
@@ -5,23 +5,23 @@
<h2>Start exam: {{exam.name}}</h2> <h2>Start exam: {{exam.name}}</h2>
Enter your CID and passcode in the below boxes.<br /> Enter your CID and passcode in the below boxes.<br />
<input id="cid-box" type="text" value="Candidate ID"><br/> <p><input id="cid-box" type="text" value="Candidate ID"></p>
<input id="passcode-box" type="text" value="Passcode"><br/> <p><input id="passcode-box" type="text" value="Passcode" </p>>
<button>Start exam</button>
<script type="text/javascript"> <button>Start exam</button>
$(document).ready(function () {
$("button").click(() => {
let cid = $("#cid-box").val();
let passcode = $("#passcode-box").val();
if (Number.isInteger(parseInt(cid))) { <script type="text/javascript">
window.location.replace("{% url 'physics:exam_take' pk=exam.pk sk=0 cid='0000000' passcode='ZZZZZZ' %}".replace("0000000", cid).replace("ZZZZZZ", passcode)); $(document).ready(function () {
} else { $("button").click(() => {
alert("Please enter a valid Candidate ID (CID).") let cid = $("#cid-box").val();
} let passcode = $("#passcode-box").val();
if (Number.isInteger(parseInt(cid))) {
window.location.replace("{% url 'physics:exam_take' pk=exam.pk sk=0 cid='0000000' passcode='ZZZZZZ' %}".replace("0000000", cid).replace("ZZZZZZ", passcode));
} else {
alert("Please enter a valid Candidate ID (CID).")
}
});
}); });
}); </script>
</script> {% endblock %}
{% endblock %}