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

Specialized question type + showOtherItem doesn't show stored comment value #9374

Open
c-meier opened this issue Jan 30, 2025 · 2 comments
Open
Labels

Comments

@c-meier
Copy link

c-meier commented Jan 30, 2025

Describe the bug
When using a specialized question type that set showOtherItem to true, the comment box does not show the stored value.

Steps to reproduce

// Create specialized question type with other item
Survey.ComponentCollection.Instance.add({ name: "custom-dropdown", title: "My dropdown", inheritBaseProps: true,
  questionJSON: {
    type: "dropdown",
    choices: ["Item 1", "Item 2", "Item 3"],
    showOtherItem: true
  },
});
// Create survey with the same question once as standard and once as a specialized question type
const surveyJson = {
  elements: [{ name: "direct",
               type: "dropdown",
               choices: ["Item 1", "Item 2", "Item 3"],
               showOtherItem: true },
             { name: "specialized",
               type: "custom-dropdown" }]
};
const survey = new Survey.Model(surveyJson);
// Fill data as if from local storage
survey.data = { "direct": "other", "direct-Comment": "Hello",
                "specialized": "other", "specialized-Comment": "World" };
function alertResults(sender) {
  const results = JSON.stringify(sender.data);
  alert(results);
}
survey.onComplete.add(alertResults);
document.addEventListener("DOMContentLoaded", function () {
 survey.render(document.getElementById("surveyContainer"));
});

Expected behavior

The comment box of the specialized question type should show it's comment value.

Screenshots

Image

Please complete the following information:

  • Browser: Firefox
  • Browser version: 133.0.3
  • JS framework/library: Vanilla JS
  • SurveyJS version: 1.12.21
  • Device: PC
@JaneSjs JaneSjs self-assigned this Feb 4, 2025
@JaneSjs
Copy link
Contributor

JaneSjs commented Feb 4, 2025

Hi,
We researched a similar issue at #9378. The fix will be available with the next maintenance update. Once a new version is available, please check to see if it works as expected.

Thanks

@JaneSjs JaneSjs removed their assignment Feb 4, 2025
@c-meier
Copy link
Author

c-meier commented Feb 4, 2025

Hi,

I tested with https://unpkg.com/[email protected]/survey.core.min.js (which if the release notes are correct contains the fix) and it doesn't work.

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

No branches or pull requests

2 participants