silverstripe-framework/javascript/DateField.js
Sam Minnee 40bc9ced5d BUGFIX Limit 'showcalendar' javascript option to DateField instances (rather than applying to all available) (from r107785)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112693 467b73ca-7a2a-4603-9d3b-597d59a354a9
2010-10-18 22:22:56 +00:00

15 lines
567 B
JavaScript

(function($) {
$('.field.date input.text').live('click', function() {
var holder = $(this).parents('.field.date:first'), config = holder.metadata();
if(!config.showcalendar) return;
if(config.locale && $.datepicker.regional[config.locale]) {
config = $.extend(config, $.datepicker.regional[config.locale], {});
}
// Initialize and open a datepicker
// live() doesn't have "onmatch", and jQuery.entwine is a bit too heavyweight for this, so we need to do this onclick.
$(this).datepicker(config);
$(this).datepicker('show');
});
}(jQuery));