Question T8683
Visible to All Users

Datepicker widget when survey is displayed in BS modal

created 3 years ago

Is a datepicker widget is displayed in a BS modal and a year and month dropdown is displayed, by default the focus keeps going back to the BS modal, and so the year and month dropdowns open and close immediately.

A workaround for this for datepicker widgets is to add this code if the datepicker is being used in the html:

$("#datepickerelement").datepicker({
beforeShow: function (input, inst) {
$(document).off('focusin.bs.modal');
},
onClose: function () {
$(document).on('focusin.bs.modal');
}
});

Is there a way to do this when the datepicker element is within a survey?

Comments (1)

    Hello,

    We affraid that it is very specific case and it is hard for us to reproduce the issue. Could you provide some working example with SurveyJS and datepicker using Plunker or CodeSandbox?

    By the way, you can clone our Custom Widgets project, add some code that you need ( for example in file - https://github.com/surveyjs/custom-widgets/blob/master/src/jquery-ui-datepicker.js ), rebuild build it and use in your application. This project has MIT license and free for use, fork and modification.

    Thank you,
    Alex
    SurveyJS Team