Matt_ Posted October 30, 2015 Share Posted October 30, 2015 Hi I'm creating a module, it has several form fields. And I just added some more - now the form is too long. So the best way to split it up is to use fieldsets for sections of the form. After reading many articles, the practice (as I understand it) is to have multiple 'form's in the array. So I had before (in my module .php file: ... public function renderForm() { $fields_form = array( 'form' => array(... then I changed this to: ... public function renderForm() { $fields_form[]['form'] = array(... } $fields_form[]['form'] = array( ... } $fields_form[]['form'] = array( ... and so on. Still at the end of that function is: ... $helper = new HelperForm(); $helper->show_toolbar = false; $helper->table = $this->table; $helper->module = $this; $lang = new Language((int)Configuration::get('PS_LANG_DEFAULT')); $helper->default_form_language = $lang->id; $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0; $helper->identifier = $this->identifier; $helper->submit_action = 'submitStoreConf'; $helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false).'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name; $helper->token = Tools::getAdminTokenLite('AdminModules'); $helper->tpl_vars = array( 'uri' => $this->getPathUri(), 'fields_value' => $this->getConfigFieldsValues(), 'languages' => $this->context->controller->getLanguages(), 'id_language' => $this->context->language->id ); return $helper->generateForm (array ($this->fields_form));} But the browser only shows a blank page (on the admin - module page) albeit the prestashop header and menu and footer. (While changing things, I had the page as before, and clicked "Save" (in the browser) .. then I made the changes .. then back in the browser, I refreshed the page and chose to re-submit the values and it said "Settings Saved" - so the post_process function seems to work.) How can I make this work as desired? Link to comment Share on other sites More sharing options...
razaro Posted October 30, 2015 Share Posted October 30, 2015 Think way you have it this should be changed return $helper->generateForm (array ($this->fields_form)); to return $helper->generateForm ($fields_form); If I am not mistaken that should be same like you created $fields_form1, $fields_form2, $fields_form3 and then used return $helper->generateForm (array ($fields_form1,$fields_form2,$fields_form3)); Link to comment Share on other sites More sharing options...
Matt_ Posted October 30, 2015 Author Share Posted October 30, 2015 All I needed to do was to change return $helper->generateForm (array ($this->fields_form)); to return $helper->generateForm ($fields_form); as said by razaro also. Thanks Link to comment Share on other sites More sharing options...
Matt_ Posted January 8, 2016 Author Share Posted January 8, 2016 [solved] Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now