tags:

views:

12

answers:

0

Dear StackOverflowers,

As stated in the subject, I am trying to add a date field with its date picker in the System > Configuration area for a custom module (thus using etc/system.xml).

I tried to get inspiration from the thread below : http://stackoverflow.com/questions/3054429/magento-add-a-button-to-system-xml-with-method-attached-to-it

but no success.

I'm sure this is a question of creating the right block or method to create a custom html field but I cannot read thru the Magento Matrix :)

I am stuck at the step where I need to code the class (Datefield.php):

    <?php
            class Namespace_Module_Block_Datefield extends Mage_Adminhtml_Block_System_Config_Form_Field {

             protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
    // ----> Am I wrong in calling ..._Abstract?  Should I call Varien_Data_Form_Element_Date? I've tried but no success either...

$this->setElement($element);

              $html = // ------------------> what to put here? Call a block or some other method?
                      ->setFormat('d-m-Y')
                      ->setLabel($this->__('Choose date'))
                      ->toHtml();

              return $html;
             }
            }    
            ?>

Do you have a trick on how to do that ?

Thanks a lot. Hervé