diff options
author | Prabhu Ramachandran | 2011-11-15 14:27:21 +0530 |
---|---|---|
committer | Prabhu Ramachandran | 2011-11-15 14:27:21 +0530 |
commit | bda8e58829b6d11ac12e3b31868fcc48e88f1c82 (patch) | |
tree | edeb397e086a21e299f52814f630b66b103e5c39 | |
parent | eb98b1b563fd664050fae8e663760a7573b12fb3 (diff) | |
download | online_test-bda8e58829b6d11ac12e3b31868fcc48e88f1c82.tar.gz online_test-bda8e58829b6d11ac12e3b31868fcc48e88f1c82.tar.bz2 online_test-bda8e58829b6d11ac12e3b31868fcc48e88f1c82.zip |
ENH: Giving user feedback when code is submitted.
Added JS code to tell the user that the system is checking the answer
and also disable any further submitting at this time.
-rw-r--r-- | templates/exam/question.html | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/templates/exam/question.html b/templates/exam/question.html index b70d97b..8d4c0bd 100644 --- a/templates/exam/question.html +++ b/templates/exam/question.html @@ -1,10 +1,25 @@ <h2> {{ question.summary }} </h2> +<script language="javascript"> +function submitCode() +{ + var x = document.getElementById("status"); + x.innerHTML = "<strong>Checking answer ...</strong>"; + x = document.getElementById("check"); + x.disabled = true; + x.value = "Checking Answer ..."; + document.getElementById("skip").disabled = true; + document.forms["code"].submit(); +} +</script> + <p>{{ question.description }} </p> {% if error_message %}<p><strong>ERROR:</strong></p><pre>{{ error_message }}</pre>{% endif %} -<form action="/exam/{{ question.id }}/check/" method="post"> +<p id="status"></p> + +<form id="code" action="/exam/{{ question.id }}/check/" method="post"> {% csrf_token %} <textarea rows="20" cols="100" name="answer"> @@ -13,8 +28,9 @@ <br/> -<input type="submit" name="check" value="Check Answer" /> -<input type="submit" name="skip" value="Skip question" /> +<input id="check" type="submit" name="check" value="Check Answer" +onclick="javascript:submitCode();"/> +<input id="skip" type="submit" name="skip" value="Skip question" /> </form> <p> {{ user.first_name.title }} {{ user.last_name.title }}, you have {{ quiz.questions_left }} question(s) left. </p> |