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

React doesn't correctly update question numbers when a questions are shown/hidden #121

Closed
jdalegonzalez opened this issue Nov 22, 2016 · 2 comments

Comments

@jdalegonzalez
Copy link
Contributor

Given the following survey definition json...

{
 pages: [
  {
   name: "page1",
   questions: [
    {
     type: "radiogroup",
     choices: [
      "one",
      {
       value: "two",
       text: "second value"
      },
      {
       value: "three",
       text: "third value"
      }
     ],
     name: "question1"
    },
    {
     type: "text",
     name: "question2",
     title: "Showing and hiding",
     visibleIf: "{question1}==\"one\""
    },
    {
     type: "text",
     name: "question3",
     title: "Always here"
    },
    {
     type: "text",
     name: "question4",
     title: "Also, always here"
    }
   ]
  }
 ]
}

Selecting "one" on the first question shows the second question, selecting anything else hides the second question. When the second question is displayed, question3 and question4 aren't renumbered. The survey questions are numbered "1, 2, 2, 3". Change the value of any of the questions will reset its number to the correct value. ie. Changing the value for question3 will cause it to be renumbered to "3". However, hiding question2 again will leave question3 with the updated number ie. the survey will now be numbered 1, 3, 3.

Renumbering works correctly on the test page of the survey designer. Perhaps this is a react only problem

@jdalegonzalez
Copy link
Contributor Author

... I forgot to mention but the "complete" button doesn't update correctly either if the visibility of the last page is toggled. For example, if you're on page2 and page3 is hidden, you would expect to see a previous button and complete button. Doing something on page2 that shows page3 should cause the complete button to now say "next". This doesn't work in react.

@andrewtelnov
Copy link
Member

@jdalegonzalez yes, the bug with buttons and progress was in both versions: knockout and react.
I have fixed it: #123.

Thank you,
Andrew

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

No branches or pull requests

2 participants