Answer the question
In order to leave comments, you need to log in
How to correctly set parameters in the constructor of the Varien_Data_Form class in Magento?
Created a simple form with one text field and "accept" button. Nothing happens when pressed. The only assumption is that I wrote the attributes incorrectly in the constructor of the Varien_Data_Form class. Where is the mistake anyway?
Here is the code itself:
include_once 'app/Mage.php';
Mage::init();
$form = new Varien_Data_Form(array(
'name' => 'form',
'action' => /*'webinse_process.php'*/Mage::getUrl('webinse-test.loc/Webinseprocess.php',
array('name'=> Mage::app()->getRequest()->getParam('name'))),
'method' => 'post'
));
$helper = Mage::helper('core');
$form->setForm($form);
$fieldset = $form->addFieldset('webinse-form', array('legend' => $helper->__('Here\'s form')));
$fieldset->addField('name', 'text', array('label' => $helper->__('Enter your name'), 'name' => 'name_label'));
$fieldset->addField('submit', 'submit', array('value' => 'Accept'));
echo $fieldset->toHtml();
Answer the question
In order to leave comments, you need to log in
Please note that as a result of executing your code, you will not find the form tag in the source code of the html page . Replace the last line of code with this:
$form->setUseContainer(true);
echo $form->toHtml();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question