Reputation: 81
I have a field that utilizes a date picker as well as a validator. In the example below, I have pre-filled the date input. Now, erase the data and you will see it is no longer valid. Then click on the calendar icon to select a date. It does not re-validate until you move away from the input (blur), but I would rather it validate any time new text is entered from the date selector. Any suggestions?
$(document).ready(function () {
$('#app').bootstrapValidator();
});
$("#dob").on('blur', function () {
$('#app').bootstrapValidator('revalidateField', 'dob');
});
$(function () {
$('#dobpicker').datetimepicker({
pickTime: false,
});
});
Upvotes: 0
Views: 599
Reputation: 1635
You can do it like this:
$("#dobpicker").on("dp.change",function (e) {
$('#app').bootstrapValidator('revalidateField', 'dob');
});
Working Fiddle
Upvotes: 1