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

Composite component: onValueChanged changes survey data with a delay #8067

Closed
andrewtelnov opened this issue Apr 7, 2024 · 0 comments · Fixed by #8068
Closed

Composite component: onValueChanged changes survey data with a delay #8067

andrewtelnov opened this issue Apr 7, 2024 · 0 comments · Fixed by #8068
Assignees
Labels
Milestone

Comments

@andrewtelnov
Copy link
Member

If you use the following code doesn't update survey.data correctly "q2" & "q3" internal question may have a different value in the survey.data

  ComponentCollection.Instance.add({
    name: "test",
    elementsJSON: [
      { type: "text", name: "q1" },
      { type: "dropdown", name: "q2", choices: [1, 2, 3] },
      { type: "text", name: "q3", choices: [1, 2, 3] }
    ],
    onValueChanged(question, name, newValue) {
      if (name === "q1") {
        question.contentPanel.getQuestionByName("q2").clearValue();
        question.contentPanel.getQuestionByName("q3").clearValue();
      }
      if (name === "q2") {
        question.contentPanel.getQuestionByName("q3").value = newValue;
      }
    },
  });
@andrewtelnov andrewtelnov added this to the v1.9.138 milestone Apr 7, 2024
@andrewtelnov andrewtelnov self-assigned this Apr 7, 2024
andrewtelnov added a commit that referenced this issue Apr 7, 2024
tsv2013 pushed a commit that referenced this issue Apr 8, 2024
@RomanTsukanov RomanTsukanov changed the title Composite component onValueChanged callback doesn't change the survey.data immediately Composite component: onValueChanged doesn't change survey data immediately Apr 9, 2024
@RomanTsukanov RomanTsukanov changed the title Composite component: onValueChanged doesn't change survey data immediately Composite component: onValueChanged changes survey data with a delay Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant