$form = new Varien_Data_Form(); $form->setHtmlIdPrefix('myform_');
$form = new Varien_Data_Form(); $form->setHtmlIdPrefix('contact_'); $fieldset = $form->addFieldset('contact_info', array('legend'=>'Contact Information')); $fieldset->addField('name', 'text', array( 'label' => 'Name', 'name' => 'name', )); $fieldset->addField('email', 'text', array( 'label' => 'Email', 'name' => 'email', )); echo $form->toHtml();In this example, we first set the HTML ID prefix for the form to 'contact_'. Then, we create a fieldset named 'contact_info' and add two fields named 'name' and 'email'. When this form is rendered using $form->toHtml(), the HTML IDs for the fields will be 'contact_name' and 'contact_email'. This function is part of the Magento Core package library.