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

QuestionImagePickerModel contains irrelevant properties related to special choices #9152

Open
budang opened this issue Dec 9, 2024 · 3 comments

Comments

@budang
Copy link

budang commented Dec 9, 2024

Describe the bug
Per the documentation (e.g., React), ImagePicker question types have the showNoneItem property which can be set to display a None choice item. Even if this attribute is set to true, no such choice item gets displayed. The same happens for showDontKnowItem, showRefuseItem, and showOtherItem properties.

https://surveyjs.io/form-library/documentation/api-reference/image-picker-question-model#showNoneItem

Steps to reproduce

  1. Go to https://plnkr.co/edit/QkTCehNe9t1qf9tJ
  2. Click on json.js
  3. Scroll down to lines 9-12
  4. See error

Expected behavior
If showNoneItem is set to true, a None choice item should appear with the default text or the custom text set in noneText. The same should happen if showDontKnowItem, showRefuseItem, and showOtherItem are set to true.

Screenshots
https://plnkr.co/edit/QkTCehNe9t1qf9tJ

Please complete the following information:

  • Browser and version: Chrome 131.0.6778.109 / Firefox 132.0.1
  • JS framework/library: React
  • SurveyJS version: 1.12.13
  • Device: MacBook Pro/macOS 15.1.1

Additional context
n/a

@JaneSjs
Copy link
Contributor

JaneSjs commented Dec 12, 2024

Hi @budang,
These settings are available for choice-based questions such as Checkboxes, Radiogroup, TagBox. However, these should not be available for an Image Picker because the Image Picker requires images to be assigned to items. In our documentation, these settings are available because the Image Picker inherits QuestionCheckboxBase settings.

We will fix this issue. If users do not want to select any image item, they can simply leave the question unselected. Or, you can use a separate question to represent these None and Don't Know items.


@RomanTsukanov, these settings should not be available for an Image Picker.

@RomanTsukanov RomanTsukanov changed the title showXItem property does not work for ImagePicker question types QuestionImagePickerModel contains irrelevant properties related to special choices Dec 16, 2024
@RomanTsukanov
Copy link
Contributor

In order to remove the unsupported properties from the Image Picker class, we need to refactor our code by putting the properties into a separate class or mixin.

@budang
Copy link
Author

budang commented Dec 17, 2024

Hello @JaneSjs and @RomanTsukanov,

Thanks for your responses. Regarding these statements:

these [settings] should not be available for an Image Picker because the Image Picker requires images to be assigned to items

you can use a separate question to represent these None and Don't Know items

For sake of discussion, while I understand that an image is assigned to these items, the value of the selected item may not necessarily be the image itself (i.e., the survey response is the item value instead of the imageLink), and I think there are valid situations for the image picker question where these settings and their corresponding values may still apply.

For example, if the question is "Select all images that have pictures of cats" but all the pictures are only of dogs, then a "None" option/value would be appropriate here. This would also be simpler/more elegant than splitting it into a two-part question.

For choices with an invalid image URL, SurveyJS provides a default graphic and makes the choice unselectable; perhaps SurveyJS can do something similar for noneItem, dontKnowItem, refuseItem, and otherItem as well (but make them selectable, and make otherItem a text-based entry like in other question models)?

This is just an idea/suggestion and not an explicit request. I do not have a personal opinion on whether to implement this suggestion or just do the code refactor.

Thanks!

@JaneSjs JaneSjs assigned JaneSjs and unassigned RomanTsukanov and JaneSjs Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants