Development

Changeset 15843

You must first sign up to be able to contribute.

Changeset 15843

Show
Ignore:
Timestamp:
02/27/09 07:12:54 (4 years ago)
Author:
fabien
Message:

[sfFormExtraPlugin] added JS date selection validity check (based on a patch from h0nIg - closes #4693)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/sfFormExtraPlugin/lib/widget/sfWidgetFormJQueryDate.class.php

    r15842 r15843  
    8787  } 
    8888 
     89  function wfd_%s_check_linked_days() 
     90  { 
     91    var daysInMonth = 32 - new Date(jQuery("#%s").val(), jQuery("#%s").val() - 1, 32).getDate(); 
     92    jQuery("#%s option").attr("disabled", ""); 
     93    jQuery("#%s option:gt(" + (%s) +")").attr("disabled", "disabled"); 
     94 
     95    if (jQuery("#%s").val() > daysInMonth) 
     96    { 
     97      jQuery("#%s").val(daysInMonth); 
     98    } 
     99  } 
     100 
    89101  jQuery(document).ready(function() { 
    90102    jQuery("#%s").datepicker(jQuery.extend({}, { 
     
    97109    }, jQuery.datepicker.regional["%s"], %s)); 
    98110  }); 
     111 
     112  jQuery("#%s, #%s, #%s").change(wfd_%s_check_linked_days); 
    99113</script> 
    100114EOF 
     
    104118      $prefix, 
    105119      $this->generateId($name.'[day]'), $this->generateId($name.'[month]'), $this->generateId($name.'[year]'), 
     120      $prefix, 
     121      $this->generateId($name.'[year]'), $this->generateId($name.'[month]'), 
     122      $this->generateId($name.'[day]'), $this->generateId($name.'[day]'), 
     123      ($this->getOption('can_be_empty') ? 'daysInMonth' : 'daysInMonth - 1'), 
     124      $this->generateId($name.'[day]'), $this->generateId($name.'[day]'), 
    106125      $id, 
    107126      min($this->getOption('years')), max($this->getOption('years')), 
    108       $prefix, $prefix, $image, $this->getOption('culture'), $this->getOption('config') 
     127      $prefix, $prefix, $image, $this->getOption('culture'), $this->getOption('config'), 
     128      $this->generateId($name.'[day]'), $this->generateId($name.'[month]'), $this->generateId($name.'[year]'), 
     129      $prefix 
    109130    ); 
    110131  } 
  • plugins/sfFormExtraPlugin/package.xml

    r15842 r15843  
    130130     <license>MIT</license> 
    131131     <notes> 
     132       * fabien: added JS date selection validity check (based on a patch from h0nIg - #4693) 
    132133       * fabien: fixed date picker on IE7 (#4751) 
    133134       * fabian: fixed javascript function names (#5261)