Monday 12 September 2011

Magento how to add Date field with DatePicker

I have creating a form i'm using in the admin page on a custome module I have been writing, Im using addField to add text fields however now need to add a date field. I changed the type from text to date and add format. heres what I have done put below code to your admin block file.

$outputFormat = Mage::app()->getLocale()->
    getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM);
$fieldset->addField('created_time', 'date', 
            array('label' = > Mage::helper('schedulelist')->__('Created Date'),
            'required' => true,
            'name' => 'created_time',
            'image' => $this->getSkinUrl('images/grid-cal.gif'),
            'format' => $outputFormat,
));

No comments:

Post a Comment