Question T5940
Visible to All Users

Matrix dropdown Required one row at a time.

created 4 years ago

Expected Outome:-
If the person ticks YES to any of the questions, please make the text box for When & Where become mandatory for that respective Yes.
The Outcome I received:-
If I choose any Yes all the when and where becomes mandatory. But I want for specific row only.

Json:-
{
"pages": [
{
"name": "page1",
"elements": [
{
"type": "panel",
"name": "panel3",
"elements": [
{
"type": "matrixdropdown",
"name": "question5",
"title": "Please answer yes or no to the questions and where the answer is yes, please answer in the comments’ column?",
"columns": [
{
"name": "Yes/No",
"cellType": "radiogroup",
"isRequired": true
},
{
"name": "When & Where?",
"cellType": "text",
"requiredIf": "{question5.Cough.Yes/No} = 'Yes' or {question5.Infection.Yes/No} = 'Yes'"
}
],
"choices": [
"Yes",
"No"
],
"rows": [
{
"value": "Cough",
"text": "Cough"
},
{
"value": "Infection",
"text": "Infection"
}
]
}
]
}
]
}
],
"showProgressBar": "top"
}

Answers approved by surveyjs Support

created 4 years ago

Hello,
Here is the correct way:

Code
requiredIf: "{row.Yes/No} = 'Yes'",

Thank you,
Andrew
SurveyJS Team

    Show previous comments (1)

      Have you tried it?
      It works for me, unless I did not understand your task. Here is the example.

      Thank you,
      Andrew
      SurveyJS Team

      DB DB
      Deepika Bansal 4 years ago

        Hi,
        Thanks a lot. It worked.
        I was using this {Cough.Yes/No} = 'Yes' instead of {row.Yes/No} = 'Yes'

          Great!

          Thank you,
          Andrew
          SurveyJS Team