Magento Varien_Form: addField() which fields are possible?
36,341
Solution 1
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.
Solution 2
Here is a list of possible field types:
text
time
textarea
submit
select
radio
password
note
multiselect
link
label
image
file
date
checkbox
Author by
tester
Updated on February 09, 2020Comments
-
tester over 4 years
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!