From 4394fde33bca18a6b151f536063a7ef136d470ea Mon Sep 17 00:00:00 2001 From: "Richard Mathot (OpenERP)" Date: Fri, 27 Dec 2013 16:37:36 +0100 Subject: [PATCH] [IMP] Print view: disable inputs bzr revid: rim@openerp.com-20131227153736-q8wwc523lg5xvi2y --- addons/survey/static/src/js/survey.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/addons/survey/static/src/js/survey.js b/addons/survey/static/src/js/survey.js index 4bccc3af3ef..ebf80b2a3fa 100644 --- a/addons/survey/static/src/js/survey.js +++ b/addons/survey/static/src/js/survey.js @@ -21,6 +21,16 @@ $(document).ready(function () { console.debug("[survey] Custom JS for survey is loading..."); + var the_form = $('.js_surveyform'); + var prefill_controller = the_form.attr("data-prefill"); + var validate_controller = the_form.attr("data-validate"); + var submit_controller = the_form.attr("data-submit"); + + // Printing mode: will disable all the controls in the form + if (_.isUndefined(submit_controller)) { + $('.js_surveyform :input').prop('disabled', true); + } + // Custom code for right behavior of radio buttons with comments box $('.js_comments>input[type="text"]').focusin(function(){ $(this).prev().find('>input').attr("checked","checked"); @@ -54,12 +64,6 @@ $(document).ready(function () { } }); - - var the_form = $('.js_surveyform'); - var prefill_controller = the_form.attr("data-prefill"); - var validate_controller = the_form.attr("data-validate"); - var submit_controller = the_form.attr("data-submit"); - // Pre-filling of the form with previous answers function prefill(){ var prefill_def = $.ajax(prefill_controller, {dataType: "json"})