Skip to content

Commit

Permalink
Question is not in the hash with it is on the first page & questionsO…
Browse files Browse the repository at this point in the history
…nPageMode is 'questionPerPage' fix #8583
  • Loading branch information
andrewtelnov committed Jul 19, 2024
1 parent d30f80f commit 775e149
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/survey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4297,6 +4297,9 @@ export class SurveyModel extends SurveyElementCore
private isLockingUpdateOnPageModes: boolean;
private setupPagesForPageModes(isSinglePage: boolean, isFirstLoad: boolean) {
this.questionHashesClear();
if(!isSinglePage && this.firstPageIsStarted && this.pages.length > 0) {
this.pages[0].questions.forEach(q => this.questionHashesAdded(q));
}
this.isLockingUpdateOnPageModes = !isFirstLoad;
var startIndex = this.getPageStartIndex();
super.startLoadingFromJson();
Expand Down
21 changes: 21 additions & 0 deletions tests/surveytests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20247,4 +20247,25 @@ QUnit.test("survey navigateToUrl encode url", function (assert) {

survey.doComplete();
assert.equal(location.href, "javascript%3Aalert(2)", "encoded URL");
});
QUnit.test("Question is not in the hash with it is on the first page & questionsOnPageMode is 'questionPerPage', Bug#8583", function (assert) {
const survey = new SurveyModel({
"pages": [{
"elements": [{
"type": "text",
"name": "q1"
}
]
},
{
"elements": [{
"type": "text",
"name": "q2"
}] }],
"firstPageIsStarted": true,
"questionsOnPageMode": "questionPerPage",
});

const q = survey.getQuestionByName("q1");
assert.equal(q.name, "q1", "q1 name is here");
});

0 comments on commit 775e149

Please sign in to comment.