From e1bf2a63de389199565e9c65764ea7e6ebf26883 Mon Sep 17 00:00:00 2001 From: Florent Bruneau Date: Mon, 24 Jan 2011 22:10:24 +0100 Subject: [PATCH] Improves answer reloading. Signed-off-by: Florent Bruneau --- htdocs/javascript/survey.js | 10 ++++++++-- templates/survey/edit.questions.tpl | 3 +-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/htdocs/javascript/survey.js b/htdocs/javascript/survey.js index 17ffcb7..7823baa 100644 --- a/htdocs/javascript/survey.js +++ b/htdocs/javascript/survey.js @@ -152,7 +152,7 @@ q = { qid: id }; } var question = $("#q_edit_new").tmpl(q); - question + var type = question .children('select[name$="[type]"]') .change(function () { var type = $(this).val(); @@ -166,6 +166,10 @@ } return true; }); + if (type.val()) { + question.children('.q_edit_form') + .bindQuestion(type.val(), q.qid); + } this.childrenContainer().children('.add_question').before(question); $.renumberQuestions(); return question; @@ -221,7 +225,8 @@ type: $(this).val(), disabled: "disabled" })); - }); + }) + .change(); return this; }, @@ -229,6 +234,7 @@ var question = this.question(); var answer = $("#q_edit_multiple_answer").tmpl({ qid: question.qid() }); question.childrenContainer().children('.add_answer').after(answer); + question.multiple_selectSubtype().change(); return answer; } }); diff --git a/templates/survey/edit.questions.tpl b/templates/survey/edit.questions.tpl index 393ebc4..5559ebf 100644 --- a/templates/survey/edit.questions.tpl +++ b/templates/survey/edit.questions.tpl @@ -97,8 +97,7 @@ -- 2.1.4