[FIX] survey: avoid autosubmit in session mode or when selecting other option
In Session Mode: Before this commit, autosubmit was only dependant of the back button, but not of the session mode. In session mode, back button is ignored, and auto-submit sould not happen in session as user has not the possibility to go back in case he misclicked. After this commit, the auto-submit only happens if back button is activated AND if we are not in session mode. This is already checked inside survey._can_go_back method and already given to the template. When selecting 'other' option: For a single or multiple choice question, if the user is selecting the 'Other' choice, Auto submit should not happen. Otherwize, the user has not the possibility the type his custom answer. Also, if the question has comment that does not count as answer, the user should still be able to add a comment after having selected the answer. The comment can be a complement of answer. Task ID: 2230980 X-original-commit: 7f03380b49a55f3c2e36f379043c33a8a17f49ed
This commit is contained in:
committed by
Thibault Delavallée
parent
f0f7f888d3
commit
d271c32058
@@ -204,9 +204,11 @@ publicWidget.registry.SurveyFormWidget = publicWidget.Widget.extend({
|
||||
}
|
||||
}
|
||||
}
|
||||
// Submit Form
|
||||
// Auto Submit Form
|
||||
var isLastQuestion = this.$('button[value="finish"]').length !== 0;
|
||||
if (!isLastQuestion && this.options.usersCanGoBack && isQuestionComplete) {
|
||||
var questionHasComment = $target.closest('.o_survey_form_choice').find('.o_survey_comment').length !== 0
|
||||
|| $target.hasClass('o_survey_js_form_other_comment');
|
||||
if (!isLastQuestion && this.options.usersCanGoBack && isQuestionComplete && !questionHasComment) {
|
||||
this._submitForm({});
|
||||
}
|
||||
} else { // $target.attr('type') === 'checkbox'
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
class="d-flex flex-grow-1 align-items-center"
|
||||
t-att-data-answer-token="answer.access_token"
|
||||
t-att-data-survey-token="survey.access_token"
|
||||
t-att-data-users-can-go-back="survey.users_can_go_back"
|
||||
t-att-data-users-can-go-back="survey.users_can_go_back and not answer.is_session_answer"
|
||||
t-att-data-session-in-progress="answer.is_session_answer"
|
||||
t-att-data-is-start-screen="answer.state == 'new'"
|
||||
t-att-data-readonly="survey_form_readonly"
|
||||
|
||||
Reference in New Issue
Block a user