diff options
author | prathamesh | 2014-06-16 17:04:40 +0530 |
---|---|---|
committer | prathamesh | 2014-06-16 17:04:40 +0530 |
commit | 763f96559bd1827ce87a72708d72efc9361ef588 (patch) | |
tree | b3de9316a59d31c785251c58baecab6c7a068c11 /testapp/static/exam/js/add_question.js | |
parent | 5adb38569bec47ea0a1ea63e22ceec8906717b04 (diff) | |
download | online_test-763f96559bd1827ce87a72708d72efc9361ef588.tar.gz online_test-763f96559bd1827ce87a72708d72efc9361ef588.tar.bz2 online_test-763f96559bd1827ce87a72708d72efc9361ef588.zip |
Models modified.
QuestionPaper model modified for generating random questions.
Added language field to Question model.
Removed tags from Quiz model.
Template and javascript for Add and Edit questions modified.
Added test cases for models.
Diffstat (limited to 'testapp/static/exam/js/add_question.js')
-rw-r--r-- | testapp/static/exam/js/add_question.js | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/testapp/static/exam/js/add_question.js b/testapp/static/exam/js/add_question.js index ba17492..56fdd1f 100644 --- a/testapp/static/exam/js/add_question.js +++ b/testapp/static/exam/js/add_question.js @@ -135,7 +135,19 @@ function textareaformat() $('#id_snippet').bind('blur', function( event ){ document.getElementById("id_snippet").rows=1; document.getElementById("id_snippet").cols=40; - }); + }); + + + $('#id_type').bind('focus', function(event){ + var type = document.getElementById('id_type'); + type.style.border = '1px solid #ccc'; + }); + + $('#id_language').bind('focus', function(event){ + var language = document.getElementById('id_language'); + language.style.border = '1px solid #ccc'; + }); + $('#id_type').bind('change',function(event){ var value = document.getElementById('id_type').value; if(value == 'mcq') @@ -167,7 +179,20 @@ function textareaformat() function autosubmit() { - if (document.getElementById('id_type').value == 'mcq') + var language = document.getElementById('id_language'); + if(language.value == 'select') + { + language.style.border="solid red"; + return false; + } + var type = document.getElementById('id_type'); + if(type.value == 'select') + { + type.style.border = 'solid red'; + return false; + } + + if (type.value == 'mcq') { var value = document.getElementById('id_options').value; if(value.split('\n').length < 4) |