From 3b37015f3e9d94b831a5eec8771b833118e6443b Mon Sep 17 00:00:00 2001 From: mahesh Date: Fri, 19 Jan 2018 13:13:25 +0530 Subject: Disable/enable shuffle testcase option based on question type --- yaksh/static/yaksh/js/add_question.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'yaksh/static') diff --git a/yaksh/static/yaksh/js/add_question.js b/yaksh/static/yaksh/js/add_question.js index 346991a..579904b 100644 --- a/yaksh/static/yaksh/js/add_question.js +++ b/yaksh/static/yaksh/js/add_question.js @@ -126,8 +126,9 @@ function textareaformat() document.getElementById('my').innerHTML = document.getElementById('id_description').value ; document.getElementById('rend_solution').innerHTML = document.getElementById('id_solution').value ; + var question_type = document.getElementById('id_type').value if (document.getElementById('id_grade_assignment_upload').checked || - document.getElementById('id_type').value == 'upload'){ + question_type == 'upload'){ $("#id_grade_assignment_upload").prop("disabled", false); } else{ @@ -142,6 +143,23 @@ function textareaformat() $("#id_grade_assignment_upload").prop("disabled", true); } }); + + if (document.getElementById('id_shuffle_testcases').checked || + question_type == "mcc" || question_type == "mcq"){ + $("#id_shuffle_testcases").prop("disabled", false); + } + else{ + $("#id_shuffle_testcases").prop("disabled", true); + } + + $('#id_type').change(function() { + if ($(this).val() == "mcc" || $(this).val() == "mcq"){ + $("#id_shuffle_testcases").prop("disabled", false); + } + else{ + $("#id_shuffle_testcases").prop("disabled", true); + } + }); } function autosubmit() -- cgit