Question T15099
Visible to All Users
Duplicate

We have closed this ticket because another page addresses its subject:

Matrix with only one selection at a time

Copy dynamic matrix cell value to single line input

created a year ago

Hello, we would like to copy the value of the selected (checkbox checked) cell in a row to a single-line input question, as shown in the example. Please note that only one row should be selected at a time.
matrix.png

JSON
{ "logoPosition": "right", "pages": [ { "name": "page1", "elements": [ { "type": "text", "name": "a" }, { "type": "matrixdynamic", "name": "b", "columns": [ { "name": "Column 1", "cellType": "checkbox", "colCount": 0, "choices": [ "X" ] }, { "name": "Column 2", "cellType": "text" }, { "name": "Column 3", "cellType": "text", "defaultValueExpression": "{rowindex}" } ], "rowCount": 3 } ] } ] }
Comments (1)

    Hello Saulius,
    From what I gather, you wish to perform these tasks:

    • Create a Dynamic Matrix which allows adding and removing rows.
    • Allow only one row selected at a time.
    • Copy the value of a Column 3 of a selected row.

    Note that for Dynamic Matrices, selecting a row at a time may require a lot of coding.
    Regarding copying the value of a cell: you can do so using the new setValueIf/setValueExpression settings. Alternatively, you can handle this from code using the survey.onMatrixCellValueChanging/survey.onMatrixCellValueChanged event.

    Would you elaborate on your task?