Skip to content

Commit 462160e

Browse files
committed
Fix: subscribe on jquery datepicker manual input change
1 parent 7339509 commit 462160e

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

examples/knockout/index.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@
1818
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.9.0/js/bootstrap-datepicker.js"></script>
1919
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.9.0/css/bootstrap-datepicker.min.css" type="text/css" rel="stylesheet"/>
2020
<!-- bootstrap-datepicker -->
21+
<!-- jquery-ui-datepicker -->
22+
<script src="https://unpkg.com/jquery"></script>
23+
<script src="https://code.jquery.com/ui/1.11.4/jquery-ui.min.js"></script><link href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css" type="text/css" rel="stylesheet"/>
24+
<script src="https://unpkg.com/[email protected]/surveyjs-widgets.min.js"></script>
25+
<!-- jquery-ui-datepicker -->
26+
2127
<!-- eo custom widgets-->
2228

2329
<!-- <script src="https://unpkg.com/survey-knockout"></script> -->

examples/knockout/index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@ function init() {
22
//$.material.init();
33

44
var json = { questions: [
5+
{
6+
"name": "date",
7+
"type": "datepicker",
8+
"inputType": "date",
9+
"title": "Your favorite date:",
10+
"dateFormat": "mm/dd/yy",
11+
"isRequired": true
12+
},
513
{ type: "dropdown", renderAs: "select2", choicesByUrl: { url: "https://restcountries.eu/rest/v1/all" }, name: "countries", title: "Please select the country you have arrived from:"}
614
]};
715

src/jquery-ui-datepicker.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ function init(Survey, $) {
105105
this.fixFocusIE = false;
106106
return result;
107107
};
108-
var pickerWidget = $el.datepicker(config);
108+
var pickerWidget = $el.datepicker(config).on("change", function (e) {
109+
question.value = $(this).val();
110+
});
109111

110112
$el.keyup(function (e) {
111113
if (e.keyCode == 8 || e.keyCode == 46) {

0 commit comments

Comments
 (0)