Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
1516 Lượt xem

For the survey, I want to add an extra question type. After submitting the form, I want to retrieve the additional question type value. This is why I need to inherit this function.


publicWidget.registry.SurveyFormWidget = publicWidget.Widget.extend(SurveyPreloadImageMixin,_prepareSubmitValues: function

(formData, params) { (formData, params) {....
this.$('[data-question-type]').each(function () {
switch ($(this).data('questionType')) {
case 'new_question_type':
params[this.name] = this.value;
break;
}

}

});


Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

I am tried this function. Its not working for me in odoo 17. how to inherit and ovrride the _initTimer js function.

_initTimer: function () {
if (this.surveyTimerWidget) {
this.surveyTimerWidget.destroy();
}

var self = this;
var $timerData = this.$('.o_survey_form_content_data');
var questionTimeLimitReached = $timerData.data('questionTimeLimitReached');
var timeLimitMinutes = $timerData.data('timeLimitMinutes');
var hasAnswered = $timerData.data('hasAnswered');
const serverTime = $timerData.data('serverTime');

if (!questionTimeLimitReached && !hasAnswered && timeLimitMinutes) {
var timer = $timerData.data('timer');
var $timer = $('<span>', {
class: 'o_survey_timer'
});
this.$('.o_survey_timer_container').append($timer);
this.surveyTimerWidget = new publicWidget.registry.SurveyTimerWidget(this, {
'serverTime': serverTime,
'timer': timer,
'timeLimitMinutes': timeLimitMinutes
});
this.surveyTimerWidget.attachTo($timer);
this.surveyTimerWidget.on('time_up', this, function (ev) {
self._submitForm({
'skipValidation': true,
'isFinish': !this.options.sessionInProgress
});
});
}
},
Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,

/** @odoo-module **/

import SurveyFormWidget from '@survey/js/survey_form';


SurveyFormWidget.include({

    // you code

});

Regards

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 5 24
1229
0
thg 1 24
936
1
thg 12 23
1467
0
thg 12 23
1187
1
thg 10 23
1353