Cart Licenses Contact Support Online Creator Login/Register
Try
Free
v 1.9.38

Matrixdynamic/dropdown detail panel


                        
        
            Survey.StylesManager.applyTheme("modern");
        



                
                    var json = {
 "checkErrorsMode": "onValueChanged",
 "pages": [
  {
   "name": "page1",
   "elements": [
    {
     "type": "matrixdynamic",
     "name": "relatives",
     "title": "Please enter all blood relatives you know",
     "columns": [
      {
       "name": "relativeType",
       "title": "Relative",
       "cellType": "dropdown",
       "isRequired": true,
       "choices": [
        "father",
        "mother",
        "brother",
        "sister",
        "son",
        "daughter"
       ]
      },
      {
       "name": "firstName",
       "title": "First name",
       "cellType": "text",
       "isRequired": true
      },
      {
       "name": "lastName",
       "title": "Last name",
       "cellType": "text",
       "isRequired": true
      }
     ],
     "detailElements": [
      {
       "type": "radiogroup",
       "name": "isalive",
       "startWithNewLine": false,
       "title": "Alive?",
       "isRequired": true,
       "choices": [
        "Yes",
        "No"
       ],
       "colCount": 0
      },
      {
       "type": "dropdown",
       "name": "liveage",
       "visibleIf": "{row.isalive} = 'Yes'",
       "startWithNewLine": false,
       "title": "Age",
       "isRequired": true,
       "choicesMin": 1,
       "choicesMax": 115
      },
      {
       "type": "dropdown",
       "name": "deceasedage",
       "visibleIf": "{row.isalive} = 'No'",
       "startWithNewLine": false,
       "title": "Deceased Age",
       "isRequired": true,
       "choices": [
        {
         "value": -1,
         "text": "Unknown"
        }
       ],
       "choicesMin": 1,
       "choicesMax": 115
      },
      {
       "type": "radiogroup",
       "name": "causeofdeathknown",
       "visibleIf": "{row.isalive} = 'No'",
       "startWithNewLine": false,
       "title": "Cause of Death Known?",
       "isRequired": true,
       "choices": [
        "Yes",
        "No"
       ],
       "colCount": 0
      },
      {
       "type": "text",
       "name": "causeofdeath",
       "visibleIf": "{row.isalive} = 'No' and {row.causeofdeathknown} = 'Yes'",
       "startWithNewLine": false,
       "title": "Cause of Death",
       "isRequired": true
      }
     ],
     "detailPanelMode": "underRow",
     "rowCount": 1,
     "addRowText": "Add a blood relative",
     "removeRowText": "Remove the relative"
    }
   ]
  }
 ]
};

                    window.survey = new Survey.Model(json);
                
        
            survey.onComplete.add(function(sender) {
            document.querySelector('#surveyResult').textContent =
            "Result JSON:\n" + JSON.stringify(sender.data, null, 3);
            });
        
survey.data = {'relatives':[{'relativeType':'father'},{'relativeType':'mother'}]};
        
            var app = new Vue({
            el: '#surveyElement',
            data:
            {
            survey: survey
            }
            });
        

                    
<!DOCTYPE html>
<html lang="en">
<head>
    <title>Matrixdynamic/dropdown detail panel, Vue Survey Library Example</title>
    
<meta name="viewport" content="width=device-width" />
    <script src="https://unpkg.com/vue@2.6.14/dist/vue.js"></script>
    <script src="/DevBuilds/survey-core/survey.core.min.js"></script>
    <script src="/DevBuilds/survey-core/survey.i18n.min.js"></script>
    <script src="/DevBuilds/survey-vue-ui/survey-vue-ui.min.js"></script>
    <link href="/DevBuilds/survey-core/modern.min.css" type="text/css" rel="stylesheet" />
    <link rel="stylesheet" href="./index.css">

</head>
<body style="margin: 0">
    
            <div id="surveyElement" style="display:inline-block;width:100%;">
                <survey :survey='survey' />
            </div>
    <div id="surveyResult"></div>

<script type="text/javascript" src="./index.js"></script>

</body>
</html>
Dismiss

Tell us what you think

Help us serve you better by taking this brief
survey. We are interested to learn more about
your experience of using our libraries.

We'd really appreciate your feedback.

Approximate time to complete: 2 min.

Start the survey