I'd like to add a date picker to a custom input field on a .phtml
. file which is loaded by Block reference, i.e:
Controller
public function indexAction()
{
$this->loadLayout();
$this->getLayout()->getBlock('head')->setTitle('Title');
$this->_setActiveMenu('namespace/module');
$this->_addContent($this->getLayout()->createBlock('namespace/adminhtml_module'));
$this->renderLayout();
}
Block
public function __construct()
{
parent::__construct();
$this->setTemplate('namespace/page.phtml');
}
Which forwards to: app/design/adminhtml/default/default/template/namespace/page.phtml
.
Now that the forwarding is set up, I can design whichever kind of layout I'd like to on that page. i.e:
<div>Enter the date here:</div>
<input name='date' id='date'></input>
I'd like to know how I can reference Magento's date picker which it uses on form elements, i.e:
$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') )
));
Any input would be much appreciated.