F
F
fedornabilkin2018-05-02 14:02:17
JavaScript
fedornabilkin, 2018-05-02 14:02:17

Why does the DateTimePicker clear non-its inputs?

When opening a modal with a form, I set the values ​​to a hidden input as recommended by bootstrap. The data is substituted, but when I start to select the date of birth using the DateTimePicker, this data is cleared.

"$('#w1').on('show.bs.modal', function (event) {
        var button = $(event.relatedTarget);
        var vacancy = button.data('vacancy');
        var modal = $(this);
        modal.find('.modal-body #candidate-uid_content').val(vacancy);
        modal.find('.modal-body #uid').val(vacancy);
    })"

I tried to substitute data in other fields directly when rendering the form and using js when opening the modal. Data is cleared only if it is set in the above way. If you substitute when drawing the form, then they are not cleared. How to substitute the data so that the picker does not touch them?
Yii2 project using kartik\datetime\DateTimePicker

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
fedornabilkin, 2018-05-02
@fedornabilkin

I did not find the reason for this behavior. Works if the value is specified as an attribute. Also, in principle, an option.

modal.find('.modal-body #candidate-uid_content').attr({'value':vacancy});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question