Skip to content

Commit

Permalink
Fix: subscribe on jquery datepicker manual input change
Browse files Browse the repository at this point in the history
  • Loading branch information
novikov82 committed Sep 8, 2021
1 parent 7339509 commit 462160e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
6 changes: 6 additions & 0 deletions examples/knockout/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
<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"/>
<!-- bootstrap-datepicker -->
<!-- jquery-ui-datepicker -->
<script src="https://unpkg.com/jquery"></script>
<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"/>
<script src="https://unpkg.com/[email protected]/surveyjs-widgets.min.js"></script>
<!-- jquery-ui-datepicker -->

<!-- eo custom widgets-->

<!-- <script src="https://unpkg.com/survey-knockout"></script> -->
Expand Down
8 changes: 8 additions & 0 deletions examples/knockout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ function init() {
//$.material.init();

var json = { questions: [
{
"name": "date",
"type": "datepicker",
"inputType": "date",
"title": "Your favorite date:",
"dateFormat": "mm/dd/yy",
"isRequired": true
},
{ type: "dropdown", renderAs: "select2", choicesByUrl: { url: "https://restcountries.eu/rest/v1/all" }, name: "countries", title: "Please select the country you have arrived from:"}
]};

Expand Down
4 changes: 3 additions & 1 deletion src/jquery-ui-datepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ function init(Survey, $) {
this.fixFocusIE = false;
return result;
};
var pickerWidget = $el.datepicker(config);
var pickerWidget = $el.datepicker(config).on("change", function (e) {
question.value = $(this).val();
});

$el.keyup(function (e) {
if (e.keyCode == 8 || e.keyCode == 46) {
Expand Down

0 comments on commit 462160e

Please sign in to comment.