123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- $('#EditQuestion').on('show.bs.modal', function(event) {
- var tableRow = $(event.relatedTarget);
- var questionNumber = $(tableRow).data('question-number');
- // var questionnaireID = $(tableRow).data('questionnaire-id');
- var questionID = $(tableRow).data('question-id');
- var premise = $(tableRow).data('premise');
- var type = $(tableRow).data('type');
- var min_text = $(tableRow).data('min_text');
- var max_val = $(tableRow).data('max_val');
- var max_text = $(tableRow).data('max_text');
- var categoryID = $(tableRow).data('categoryid');
- var subcategoryID = $(tableRow).data('subcategoryid');
- var modal = $(this);
-
- // console.log('questionNumber' + questionNumber);
- // console.log('questionnaireID' + questionnaireID);
- // console.log('questionID' + questionID);
- // console.log('premise' + premise);
- // console.log('type' + type);
- // console.log('min_text' + min_text);
- // console.log('max_val' + max_val);
- // console.log('max_text' + max_text);
- // console.log('categoryID' + categoryID);
- // console.log('subcategoryID' + subcategoryID);
- // console.log(modal);
-
- deleteModal = $('#Delete');
- deleteModal.find('.modal-body [name=questionID]').val(questionID);
- deleteModal.find('.modal-body .question-number').text(questionNumber);
-
- modal.find('.modal-body .question-number').text(questionNumber);
- // modal.find('.modal-body input[name="questionnaireID"]').val(questionnaireID);
- modal.find('.modal-body input[name="questionID"]').val(questionID);
- modal.find('.modal-body input[name="update_q_premise"]').val(premise);
- modal.find('.modal-body select[name="update_q_type"]').val(type);
- // min_val not necessary (always 1)
- modal.find('.modal-body input[name="update_min_text"]').val(min_text);
- modal.find('.modal-body input[name="update_max_val"]').val(max_val);
- modal.find('.modal-body input[name="update_max_text"]').val(max_text);
- modal.find('.modal-body select[name="update_q_category"]').val(categoryID);
- modal.find('.modal-body select[name="update_q_subcategory"]').val(subcategoryID);
-
-
- if(type === 2) {
- modal.find('.modal-body .range').css('display', 'none');
- } else if(type === 1) {
- modal.find('.modal-body .range').css('display', 'block');
- }
-
-
- });
|