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

Select-based questions: Users can add new choice options even though item addition is disabled using the onCollectionItemAllowOperations event #5521

Closed
JaneSjs opened this issue May 22, 2024 · 0 comments · Fixed by #5529
Assignees
Labels
bug user issue An issue or bug reported by users.
Milestone

Comments

@JaneSjs
Copy link
Contributor

JaneSjs commented May 22, 2024

I want to disable the New Item option on a design surface. When setting the options.allowAdd to false within the creator.onCollectionItemAllowOperations event, the new item button disappears, however, the non-existing item persists.
View Demo

creator.onCollectionItemAllowOperations.add((sender, options) => {
      if(!!options.obj.choices) {
        options.allowAdd = false;
      }
    })

image

Workaround: it is possible to disable the new item using the survey.onShowingChoiceItem event (view an example). In the same manner, you would disable the special options (example).

@JaneSjs JaneSjs added the bug label May 22, 2024
@andrewtelnov andrewtelnov self-assigned this May 23, 2024
@andrewtelnov andrewtelnov added the user issue An issue or bug reported by users. label May 23, 2024
andrewtelnov added a commit that referenced this issue May 23, 2024
…using the creator.onCollectionItemAllowOperations event fix #5521
tsv2013 pushed a commit that referenced this issue May 27, 2024
…using the creator.onCollectionItemAllowOperations event fix #5521 (#5529)
@OlgaLarina OlgaLarina added this to the v1.10.6 milestone May 29, 2024
@RomanTsukanov RomanTsukanov changed the title Choices - The new item remains visible after disabling item addition using the creator.onCollectionItemAllowOperations event Select-based questions: Users can add new choice options even though item addition is disabled using the onCollectionItemAllowOperations event May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug user issue An issue or bug reported by users.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants