magento gives error while creating form -


i want build form. tried lot below code gives me error.

error:

2015-08-03t08:49:26+00:00 err (3): recoverable error: argument 1 passed mage_adminhtml_block_widget_form::setform() must instance of varien_data_form, instance of mage_adminhtml_block_system_config_form given, called in c:\xampp\htdocs\magentobigcom\app\code\core\mage\adminhtml\block\system\config\form.php on line 315 , defined  in c:\xampp\htdocs\magentobigcom\app\code\core\mage\adminhtml\block\widget\form.php on line 119 2015-08-03t08:49:26+00:00 err (3): recoverable error: argument 1 passed varien_data_form_element_abstract::setrenderer() must implement interface varien_data_form_element_renderer_interface, instance of sample_bigcom_block_adminhtml_form_edit_file given, called in c:\xampp\htdocs\magentobigcom\app\code\core\mage\adminhtml\block\system\config\form.php on line 438 , defined  in c:\xampp\htdocs\magentobigcom\lib\varien\data\form\element\abstract.php on line 164 

and code here:

<?php class sample_bigcom_block_adminhtml_form_edit_file extends mage_adminhtml_block_widget_form {       protected function _prepareform() {         $form = new varien_data_form(array( 'id' => 'edit_form', 'action' => $this->geturl('*/*/process', array('id' => $this->getrequest()->getparam('id'))), 'method' => 'post', 'enctype' => 'multipart/form-data' ) );              return parent::_prepareform();     }  } 

is there thing should write in config file or system file rid of error?

can give me solution?

you should try setting form on $this.

protected function _prepareform() {     $form = new varien_data_form(array(         'id' => 'edit_form',         'action' => $this->geturl('*/*/process', array('id' => $this->getrequest()->getparam('id'))),         'method' => 'post',         'enctype' => 'multipart/form-data'         )     );      $this->setform($form);      return parent::_prepareform(); } 

furthermore recommend using container (extends mage_adminhtml_block_widget_form_container) around form.

here nice tutorials:

http://excellencemagentoblog.com/blog/2011/11/01/module-development-series-magento-admin-module-part3/

http://astrio.net/blog/magento-admin-form/


Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -