diff options
-rw-r--r-- | yaksh/static/yaksh/js/question_paper_creation.js | 14 | ||||
-rw-r--r-- | yaksh/templates/yaksh/design_questionpaper.html | 8 |
2 files changed, 19 insertions, 3 deletions
diff --git a/yaksh/static/yaksh/js/question_paper_creation.js b/yaksh/static/yaksh/js/question_paper_creation.js index 898e491..430ec4b 100644 --- a/yaksh/static/yaksh/js/question_paper_creation.js +++ b/yaksh/static/yaksh/js/question_paper_creation.js @@ -46,4 +46,18 @@ $(document).ready(function(){ $("#random").click(); }); + var checked_vals = []; + $('input:checkbox[name="questions"]').click(function() { + if($(this).prop("checked") == true){ + checked_vals.push(parseInt($(this).val())); + } + else{ + checked_vals.pop(parseInt($(this).val())); + } + }); + $('#design_q').submit(function(eventObj) { + $(this).append('<input type="hidden" name="checked_ques" value='+checked_vals+'>'); + return true; +}); + });//document diff --git a/yaksh/templates/yaksh/design_questionpaper.html b/yaksh/templates/yaksh/design_questionpaper.html index 4418c27..829e27f 100644 --- a/yaksh/templates/yaksh/design_questionpaper.html +++ b/yaksh/templates/yaksh/design_questionpaper.html @@ -23,7 +23,7 @@ select {% block content %} <input type=hidden id="url_root" value={{ URL_ROOT }}> -<form action="{{ URL_ROOT }}/exam/manage/designquestionpaper/{{ qpaper.quiz.id }}/{{ qpaper.id }}/" method="POST"> +<form action="{{ URL_ROOT }}/exam/manage/designquestionpaper/{{ qpaper.quiz.id }}/{{ qpaper.id }}/" method="POST" id="design_q"> <input class ="btn primary small" type="submit" name="back" id="back" value="Cancel"> {% csrf_token %} <input type=hidden name="is_active" id="is_active" value="{{ state }}"> @@ -95,8 +95,10 @@ select {% for question in fixed_questions %} <li> <label> - <input type="checkbox" name="added-questions" data-qid="{{question.id}}" value={{question.id}}> - <span> {{ question.summary }} </span> <span> {{ question.points }} </span> + <input type="checkbox" name="added-questions" + data-qid="{{question.id}}" value={{question.id}}> + <span> {{ question.summary }} </span> + <span> {{ question.points }} </span> </label> </li> {% endfor %} |