I have a problem with my jQuery datepicker.
If I sumbit the form without a value in the datepicker, it tells me to enter a date.
When I do pick a date it's like its not getting updated, and still want me to enter a date.
Look at this fiddle :
http://jsfiddle.net/xa5gn1kq/12/
$(document).ready(function () {
$("#rental-form").bootstrapValidator({
framework: 'bootstrap',
feedbackIcons: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
live: 'enabled',
submitButtons: 'button[id="rental-submit"]',
fields: {
datePicker: {
validators: {
notEmpty: {
message: 'Velg en dato'
},
date: {
format: 'MM-DD-YYYY',
message: 'Datoen er ikke i riktig format, velg fra listen - eller skriv i følgende format: mm-dd-yyyy'
}
}
}
}
});
$('#datePicker').datepicker({
dateFormat: 'mm-dd-yy',
minDate: "0",
endDate: "01-01-2016",
todayBtn: "linked",
autoclose: true,
onSelect: function (date, inst) {
$('#data').text(this.value);
$('#rental-form').formValidation('revalidateField', 'datePicker');
}
});
});
Try submitting without a date, then choose a date and see that the validation error isn't removed.