$element = new Varien_Data_Form_Element_Text(); $element->setName('email') ->setLabel('Email Address') ->setClass('input-text validate-email') ->setRequired(true);
$element = new Varien_Data_Form_Element_Select(); $element->setName('country') ->setLabel('Country') ->setClass('input-select') ->setOptions(array( 'us' => 'United States', 'ca' => 'Canada', 'mx' => 'Mexico', ));In this example, we create a select element for choosing a country, set the name and label, then use the addClass method to add the "input-select" class to the element. We also set options for the select element using the setOptions method. Package/Library: This code belongs to Magento Framework.