question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Clicking on already selected answer does not go to next page with goNextPageAutomatic

See original GitHub issue

Are you requesting a feature, reporting a bug or asking a question?

Asking a question or a bug. Not really sure if it’s a bug.

What is the current behavior?

  • I created a survey with 2 pages (1 question per page) where all the question types are radiogroup.
  • I have set goNextPageAutomatic to true(and allowed the next and previous buttons to be visible as well).
  • In page1, When I choose an answer (say ans1), I automatically go to the next page(page2), which is correct.
  • In page2, I click on the previous button, to go back to page1
  • Now, I can only go to page2 if I select any other answer apart from ans1. Clicking on ans1, does not automatically go to the next page. Is there a way I can enable this behaviour?

What is the expected behavior?

Clicking on an already selected answer, should automatically go to the next page with goNextPageAutomatic. It is currently not going to the next page.

How would you reproduce the current behavior (if this is a bug)?

Here is the example in plunker.

  • Select ans1. It automatically goes to next page.
  • Click on previous.
  • Select ans1 again. It does not go to the next-page, although it should.

Specify your

  • browser: firefox
  • browser version: 64.0.2 (64 bit)
  • surveyjs platform (angular or react or jquery or knockout or vue): Survey js react
  • surveyjs version: 1.0.72

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
babgyycommented, Oct 11, 2021

For future readers who, like me, also wanted this behavior : here my solution on the survey-react-ui package 1.8.71 (also worked on survey-react v1.0.60)

I am using the react components, and overrode SurveyQuestionRadioItem to tweak things a bit.

  • On the input : Replace the onChange callback by an onClick, this way the callback is called even when the value does not change.
  • In the callback : clear the value before assigning it, thus forcing a model change, and triggering the page change (see below)
handleOnClick(event: any) {
  if (this.isChecked) {
    this.question.renderedValue = null
  }
  this.question.renderedValue = this.item.value
}

Of course you will have to override SurveyQuestionRadiogroup to use your own SurveyQuestionRadioItem, and register it to Survey.ReactQuestionFactory to be used for radiogroup questions

Survey.ReactQuestionFactory.Instance.registerQuestion("radiogroup", (props: any) => {
  return <YourOwnSurveyQuestionRadiogroup {...props} />
})
0reactions
babgyycommented, Nov 5, 2021

The scenario is this :

  • goNextPageAutomatic is enabled
  • we do display navigation buttons

When clicking previous to see previously answered questions, it felt weird because the only way to go forward was :

  • clicking Next again OR
  • changing your answer Doing the same thing as when answering the question initially now does nothing even though it worked the first time, it really feels buggy.

I understand the argument : “the data does not change, hence goNextPageAutomatic does nothing”, but in my opinion it is a bit too strict. A user interaction is a data validation. And buttons should (IMHO) behave consistently when presented multiple times, as much as possible.

Anyway, I love surveyjs, thanks for this great lib.

Read more comments on GitHub >

github_iconTop Results From Across the Web

JS trigger next button and previous button through selected ...
Hello everyone, I need to add a script at a "yes or no"-question. If a subject clicks yes, the next question should be...
Read more >
Whats New - SurveyJS
A survey immediately switches to the next page ( goNextPageAutomatic: true ). Expected behavior: a survey doesn't switch to the next page when...
Read more >
survey-knockout - UNPKG
It doesn't reset properties that was changed before and they are not defined ... answering all the questions on a page without pressing...
Read more >
Skip pages or questions that have already been answered
After a user has gone through the survey we give them an option to go back to the first page and select more...
Read more >
survey.react.d.ts
Action items can be displayed in certain survey elements - in Toolbar (or action bar), ... Goes to the next page if `goNextPageAutomatic`...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found