Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Record order of questions that are randomized #170

Open
JamesPHoughton opened this issue Jan 26, 2024 · 1 comment
Open

Record order of questions that are randomized #170

JamesPHoughton opened this issue Jan 26, 2024 · 1 comment
Labels
Survey A sourced survey to implement

Comments

@JamesPHoughton
Copy link
Contributor

JamesPHoughton commented Jan 26, 2024

When we randomize questions on the page, we want to know the order that those questions appear to the user, and save this with the response. Recording and saving with the state might help with: #151

@JamesPHoughton JamesPHoughton added the Survey A sourced survey to implement label Jan 26, 2024
@JamesPHoughton
Copy link
Contributor Author

JamesPHoughton commented Jan 26, 2024

Copilot suggests this:

let questionOrder = [];

survey.onAfterRenderQuestion.add(function(survey, options) {
    questionOrder.push(options.question.name);
});

// After the survey is completed, you can see the order of questions
survey.onComplete.add(function(result) {
    console.log(questionOrder);
});

Strictly speaking, this only records the chronological order they were displayed in, not the visual order on the page

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Survey A sourced survey to implement
Projects
None yet
Development

No branches or pull requests

1 participant