mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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
This commit is contained in:
parent
fd6fa62388
commit
40bc9ced5d
@ -205,7 +205,7 @@ class DateField extends TextField {
|
||||
|
||||
if(Validator::get_javascript_validator_handler() == 'none') return true;
|
||||
|
||||
if($this->showSeparateFields) {
|
||||
if($this->getConfig('dmyfields')) {
|
||||
$error = _t('DateField.VALIDATIONJS', 'Please enter a valid date format (DD/MM/YYYY).');
|
||||
$error = 'Please enter a valid date format (DD/MM/YYYY) from dmy.';
|
||||
$jsFunc =<<<JS
|
||||
@ -517,7 +517,11 @@ class DateField_View_JQuery {
|
||||
if($this->getField()->getConfig('showcalendar')) {
|
||||
// Inject configuration into existing HTML
|
||||
$format = self::convert_iso_to_jquery_format($this->getField()->getConfig('dateformat'));
|
||||
$this->getField()->addExtraClass(str_replace('"', '\'', Convert::raw2json(array('dateFormat' => $format))));
|
||||
$conf = array(
|
||||
'showcalendar' => true,
|
||||
'dateFormat' => $format
|
||||
);
|
||||
$this->getField()->addExtraClass(str_replace('"', '\'', Convert::raw2json($conf)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
(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], {});
|
||||
|
Loading…
Reference in New Issue
Block a user