Cart Buy Licenses Contact Support Login/Register
v 1.8.9
v 1.8.9
Overview Examples Docs Source Download

Bootstrap Datepicker

Custom widget: Bootstrap Datepicker

Third-party libraries: Bootstrap Datepicker Apache

                        
        
            Survey.StylesManager.applyTheme("modern");
        


            
                var json = {
  "elements": [
    {
      "name": "date",
      "type": "bootstrapdatepicker",
      "inputType": "date",
      "title": "Your favorite date:",
      "dateFormat": "mm/dd/yy",
      "isRequired": true
    }
  ]
};

                window.survey = new Survey.Model(json);
            
        
            survey.onComplete.add(function(result) {
            document.querySelector('#surveyResult').textContent =
            "Result JSON:\n" + JSON.stringify(result.data, null, 3);
            });
        
        
            $("#surveyElement").Survey({
            model: survey 
            });
        

                    
<!DOCTYPE html>
<html lang="en">
<head>
    <title>Custom widget: Bootstrap Datepicker, jQuery Survey Library Example</title>

<meta name="viewport" content="width=device-width" />
    <script src="https://unpkg.com/jquery"></script>
<script src="https://surveyjs.azureedge.net/1.8.9/survey.jquery.min.js"></script>
<link href="https://surveyjs.azureedge.net/1.8.9/modern.css" type="text/css" rel="stylesheet" />
    <link rel="stylesheet" href="./index.css">
<script src="https://unpkg.com/moment@2.24.0/moment.js"></script>
<link rel="stylesheet" href="https://unpkg.com/bootstrap@3.3.7/dist/css/bootstrap.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.9.0/js/bootstrap-datepicker.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.9.0/css/bootstrap-datepicker.min.css" type="text/css" rel="stylesheet"/>    <script src="https://surveyjs.azureedge.net/1.8.9/surveyjs-widgets.js"></script>

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

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

</body>
</html>
settings

Date format: (default is 'mm/dd/yy')

var q = survey.getQuestionByName('date');
q.dateFormat = yourvalue; 
survey.render();