diff --git a/src/survey.ts b/src/survey.ts index 72f2bbcf6c..f6973f53de 100644 --- a/src/survey.ts +++ b/src/survey.ts @@ -1678,7 +1678,7 @@ export class SurveyModel extends SurveyElementCore * @see [`settings.autoAdvanceDelay`](https://surveyjs.io/form-library/documentation/api-reference/settings#autoAdvanceDelay) */ public get allowCompleteSurveyAutomatic(): boolean { - return this.getPropertyValue("allowCompleteSurveyAutomatic", true); + return this.getPropertyValue("allowCompleteSurveyAutomatic"); } public set allowCompleteSurveyAutomatic(val: boolean) { this.setPropertyValue("allowCompleteSurveyAutomatic", val); @@ -7847,6 +7847,10 @@ Serializer.addClass("survey", [ obj.setPropertyValue("goNextPageAutomatic", value); } }, + { + name: "allowCompleteSurveyAutomatic:boolean", default: true, + visibleIf: (obj: any): boolean => obj.goNextPageAutomatic === true + }, { name: "clearInvisibleValues", default: "onComplete", diff --git a/tests/surveytests.ts b/tests/surveytests.ts index de7fb549da..deae65ba1c 100644 --- a/tests/surveytests.ts +++ b/tests/surveytests.ts @@ -4179,6 +4179,26 @@ QUnit.test( assert.equal(survey.state, "completed"); } ); +QUnit.test("goNextPageAutomatic and allowCompleteSurveyAutomatic=false", function (assert) { + const emptySurvey = new SurveyModel(); + assert.equal(emptySurvey.allowCompleteSurveyAutomatic, true, "allowCompleteSurveyAutomatic value # 1"); + const survey = new SurveyModel({ + pages: [ + { elements: [{ type: "dropdown", name: "q1", choices: [1, 2, 3] }] }, + { elements: [{ type: "dropdown", name: "q2", choices: [1, 2, 3] }] } + ], + goNextPageAutomatic: true, + allowCompleteSurveyAutomatic: false + }); + assert.equal(survey.allowCompleteSurveyAutomatic, false, "allowCompleteSurveyAutomatic value # 2"); + const q1 = survey.getQuestionByName("q1"); + const q2 = survey.getQuestionByName("q2"); + assert.equal(survey.currentPageNo, 0, "curPage #1"); + q1.value = 1; + assert.equal(survey.currentPageNo, 1, "curPage #2"); + q2.value = 1; + assert.equal(survey.currentPageNo, 1, "curPage #2"); +}); QUnit.test("goNextPageAutomatic and checkbox wiht valueName bug #70", function ( assert