I have been working on admin form where I want the user to select Start Date
and End Date
.
I have to provide validation such that the End Date
must be greater than Start Date
.
Could anyone pls help me in providing defautl Magento validation class for start and end date with the scenario as explained above?
If its not possible with default Magento validation, pls post custom JS code.
Also this is in my form for date range
$dateFormatIso = Mage::app()->getLocale()->getDateFormat(
Mage_Core_Model_Locale::FORMAT_TYPE_SHORT
);
$fieldset->addField('start_date', 'date', array(
'label' => Mage::helper('myhelper')->__('Start Date'),
'name' => 'start_date',
'note' => $this->__('Start Date'),
'required' => true,
'image' => $this->getSkinUrl('images/grid-cal.gif'),
'format' => $dateFormatIso,
'class' => 'required-entry validate-date validate-date-range date-range-start_date-from'
));
$fieldset->addField('end_date', 'date', array(
'label' => Mage::helper('myhelper')->__('End Date'),
'name' => 'end_date',
'note' => $this->__('End Date'),
'required' => true,
'image' => $this->getSkinUrl('images/grid-cal.gif'),
'format' => $dateFormatIso,
'class' => 'required-entry validate-date validate-date-range date-range-end_date-to'
));
Thanks