Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Magento Varien_Form: addField() which fields are possible?

Tags:

forms

magento

For Magento Backend I created a Varien_Form to display.

class MyNamespace_MyModule_Block_Adminhtml_MyModule_Edit_Tabs_Form
        extends Mage_Adminhtml_Block_Widget_Form {    
    protected function _prepareForm()
    {
        $form = new Varien_Data_Form();
        $this->setForm($form);
        $fieldset = $form->addFieldset('my_form', array('legend'=>'ABC'));

        $fieldset->addField('data', 'text',
            array(
                'label' => 'My Textfield',
                'name' => 'myTextField'
            ));
        return parent::_prepareForm();
    }
}

My question is now, which form fields are possible at all? You see the function addField() where it says 'text'? I heard of 'checkbox' and 'hidden'. But is there a list of all possible fields? Like Label or a textbox for more lines etc. Thanks a lot!

like image 645
tester Avatar asked Dec 02 '22 00:12

tester


1 Answers

The different form elements you can use are all found in lib/Varien/Data/Form/Element, you can find help using some of them at http://www.excellencemagentoblog.com/magento-admin-form-field

You can use textarea for a multiline textbox.

like image 106
Josh Avatar answered Dec 04 '22 10:12

Josh