Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

magento add calender date picker to custom form in admin (custom module)

I have created custom module from - Modulecreator.
Now I want to add calender date picker field in my custom form -(in admin side).
Like From date To date.

The value selected from date picker should be added into the database on submitting.
Thanks.

like image 588
Nikhil_K_R Avatar asked Nov 08 '12 10:11

Nikhil_K_R


Video Answer


1 Answers

$fieldset->addField('date', 'date', array(
    'name'               => 'date',
    'label'              => Mage::helper('your_module_name')->__('Date'),
    'after_element_html' => '<small>Comments</small>',
    'tabindex'           => 1,
    'image'              => $this->getSkinUrl('images/grid-cal.gif'),
    'format'             => Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT) ,
    'value'              => date( Mage::app()->getLocale()->getDateStrFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT),
                                  strtotime('next weekday') )
));
like image 188
Nikhil_K_R Avatar answered Sep 27 '22 17:09

Nikhil_K_R