Skip to Content
Menu
This question has been flagged
2 Replies
1166 Views

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;
}

}

});


Avatar
Discard
Best Answer

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
});
});
}
},
Avatar
Discard
Best Answer

Hi,

/** @odoo-module **/

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


SurveyFormWidget.include({

    // you code

});

Regards

Avatar
Discard
Related Posts Replies Views Activity
1
May 24
936
0
Jan 24
506
1
Dec 23
1086
0
Dec 23
709
1
Oct 23
995