Ir al contenido
Menú
Se marcó esta pregunta
2 Respuestas
1500 Vistas

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
Descartar
Mejor respuesta

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
Descartar
Mejor respuesta

Hi,

/** @odoo-module **/

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


SurveyFormWidget.include({

    // you code

});

Regards

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
1
may 24
1228
0
ene 24
933
1
dic 23
1445
0
dic 23
1179
1
oct 23
1331