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

[Knockout] Multi-Select Matrix with a checkbox column allows users to select more choices than the specified number of maxSelectedChoices #6865

Closed
JaneSjs opened this issue Sep 4, 2023 · 0 comments
Assignees
Labels
bug user issue An issue or bug reported by users
Milestone

Comments

@JaneSjs
Copy link
Contributor

JaneSjs commented Sep 4, 2023

Usage Scenario: only allow a specific options selected per row for a matrix.
T14484 - Enableif based on selection for Matrix Dropdown Rows
https://surveyjs.answerdesk.io/internal/ticket/details/T14484


View Demo for React - It works as expected - users cannot select more than 2 options per row.
image
Related issue: #6866.

View Demo for Knockout - It is still possible to select more than 2 options per row.

{
 "logoPosition": "right",
 "pages": [
  {
   "name": "pg_Q1",
   "elements": [
    {
     "type": "matrixdropdown",
     "name": "Q1",
     "title": "Select up to two products that each statement best represents. ",
     "isRequired": true,
     "validators": [
      {
       "type": "expression",
       "text": "Maximum 2 options per row are allowed",
       "expression": "{Q1.1.insulinTypes.length} <= 2"
      },
      {
       "type": "expression",
       "text": "Maximum 2 options per row are allowed",
       "expression": "{Q1.2.insulinTypes.length} <= 2"
      },
      {
       "type": "expression",
       "text": "Maximum 2 options per row are allowed",
       "expression": "{Q1.3.insulinTypes.length} <= 2"
      },
      {
       "type": "expression",
       "text": "Maximum 2 options per row are allowed",
       "expression": "{Q1.4.insulinTypes.length} <= 2"
      },
      {
       "type": "expression",
       "text": "Maximum 2 options per row are allowed",
       "expression": "{Q1.5.insulinTypes.length} <= 2"
      },
      {
       "type": "expression",
       "text": "Maximum 2 options per row are allowed",
       "expression": "{Q1.6.insulinTypes.length} <= 2"
      }
     ],
     "columns": [
      {
       "name": "insulinTypes",
       "title": "Toujeo",
       "cellType": "checkbox",
       "showInMultipleColumns": true,
       "choices": [
        {
         "value": "toujeo",
         "text": "Toujeo"
        },
        {
         "value": "tresiba",
         "text": "Tresiba"
        },
        {
         "value": "lantus",
         "text": "Lantus"
        },
        {
         "value": "xultophy",
         "text": "Xultophy"
        },
        {
         "value": "novoMix",
         "text": "NovoMix"
        }
       ],
       "maxSelectedChoices": 2
      }
     ],
     "cellType": "checkbox",
     "rows": [
      {
       "value": "1",
       "text": "Is the most affordable injectable diabetes medication"
      },
      {
       "value": "2",
       "text": "Is listed (restricted or un-restricted) in the Diabetes Law"
      },
      {
       "value": "3",
       "text": "Guidelines recommend to use it"
      },
      {
       "value": "4",
       "text": "Is always on the formulary"
      },
      {
       "value": "5",
       "text": "Is a product without restrictions on use"
      },
      {
       "value": "6",
       "text": "Is a product which is always fully reimbursed or with affordable patient co-pay"
      }
     ]
    }
   ]
  }
 ]
}

image

@JaneSjs JaneSjs added bug user issue An issue or bug reported by users labels Sep 4, 2023
@andrewtelnov andrewtelnov self-assigned this Sep 5, 2023
andrewtelnov added a commit that referenced this issue Sep 7, 2023
novikov82 pushed a commit that referenced this issue Sep 8, 2023
* Refactor code and write functional test #6865

* Fix the issue #6865
@andrewtelnov andrewtelnov added this to the v1.9.107 milestone Sep 8, 2023
@RomanTsukanov RomanTsukanov changed the title [Knockout] Multi-Select Matrix with a Checkbox column (Show in Multiple Columns) - It is possible to select more choices than the specified number of maxSelectedChoices [Knockout] Multi-Select Matrix with a checkboxes column allows users to select more choices than the specified number of maxSelectedChoices Sep 11, 2023
@RomanTsukanov RomanTsukanov changed the title [Knockout] Multi-Select Matrix with a checkboxes column allows users to select more choices than the specified number of maxSelectedChoices [Knockout] Multi-Select Matrix with a checkbox column allows users to select more choices than the specified number of maxSelectedChoices Sep 11, 2023
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

No branches or pull requests

2 participants