Serial Posted June 6, 2017 Share Posted June 6, 2017 Hi, I've created back-office module with a form. I want to create a second form on the same configuration page of my module but I don't know how to do that. I'm on PS 1.6. Do you have any solution ? Thanks Link to comment Share on other sites More sharing options...
Nishith Nesdiya Posted June 6, 2017 Share Posted June 6, 2017 Hi, I've created back-office module with a form. I want to create a second form on the same configuration page of my module but I don't know how to do that. I'm on PS 1.6. Do you have any solution ? Thanks Hi.. see this demo create a multiple form same configuration page public function renderForm() { $fields_form_1 = array( 'form' => array( 'legend' => array( 'title' => $this->l('Settings'), 'icon' => 'icon-cogs' ), 'input' => array( array( 'type' => 'text', 'label' => $this->l('text'), 'name' => 'text', ), array( 'type' => 'text', 'label' => $this->l('text2'), 'name' => 'text2', ), ), 'submit' => array( 'title' => $this->l('Save'), 'class' => 'btn btn-default pull-right', 'name' => 'submitForm1', ) ), ); $fields_form_2 = array( 'form' => array( 'legend' => array( 'title' => $this->l('Settings'), 'icon' => 'icon-cogs' ), 'input' => array( array( 'type' => 'textarea', 'autoload_rte' => true, 'label' => $this->l('textarea'), 'name' => 'textarea', ) ), 'submit' => array( 'title' => $this->l('Save'), 'class' => 'btn btn-default pull-right', 'name' => 'submitForm2', ) ), ); $helper = new HelperForm(); $helper->show_toolbar = false; $helper->table = $this->table; $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 = 'submitModule'; $helper->module = $this; $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( 'currencies' => Currency::getCurrencies(), 'fields_value' => $this->getConfigFieldsValues(), 'languages' => $this->context->controller->getLanguages(), 'id_language' => $this->context->language->id ); return $helper->generateForm(array($fields_form_1, $fields_form_2)); } Thanks Link to comment Share on other sites More sharing options...
Serial Posted June 6, 2017 Author Share Posted June 6, 2017 (edited) Hi.. see this demo create a multiple form same configuration page public function renderForm() { $fields_form_1 = array( 'form' => array( 'legend' => array( 'title' => $this->l('Settings'), 'icon' => 'icon-cogs' ), 'input' => array( array( 'type' => 'text', 'label' => $this->l('text'), 'name' => 'text', ), array( 'type' => 'text', 'label' => $this->l('text2'), 'name' => 'text2', ), ), 'submit' => array( 'title' => $this->l('Save'), 'class' => 'btn btn-default pull-right', 'name' => 'submitForm1', ) ), ); $fields_form_2 = array( 'form' => array( 'legend' => array( 'title' => $this->l('Settings'), 'icon' => 'icon-cogs' ), 'input' => array( array( 'type' => 'textarea', 'autoload_rte' => true, 'label' => $this->l('textarea'), 'name' => 'textarea', ) ), 'submit' => array( 'title' => $this->l('Save'), 'class' => 'btn btn-default pull-right', 'name' => 'submitForm2', ) ), ); $helper = new HelperForm(); $helper->show_toolbar = false; $helper->table = $this->table; $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 = 'submitModule'; $helper->module = $this; $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( 'currencies' => Currency::getCurrencies(), 'fields_value' => $this->getConfigFieldsValues(), 'languages' => $this->context->controller->getLanguages(), 'id_language' => $this->context->language->id ); return $helper->generateForm(array($fields_form_1, $fields_form_2)); } Thanks Okay. So, I can delete getConfigForm() function ? Edited June 6, 2017 by Serial (see edit history) Link to comment Share on other sites More sharing options...
phinq1910 Posted June 6, 2017 Share Posted June 6, 2017 Yes, you can but I think you dont need , try hide by css on your module. Link to comment Share on other sites More sharing options...
pawelszulc Posted May 23, 2019 Share Posted May 23, 2019 Quote public function renderForm() { $fields_form_1 = array( 'form' => array( 'legend' => array( 'title' => $this->l('Settings'), 'icon' => 'icon-cogs' ), 'input' => array( array( 'type' => 'text', 'label' => $this->l('text'), 'name' => 'text', ), array( 'type' => 'text', 'label' => $this->l('text2'), 'name' => 'text2', ), ), 'submit' => array( 'title' => $this->l('Save'), 'class' => 'btn btn-default pull-right', 'name' => 'submitForm1', ) ), ); $fields_form_2 = array( 'form' => array( 'legend' => array( 'title' => $this->l('Settings'), 'icon' => 'icon-cogs' ), 'input' => array( array( 'type' => 'textarea', 'autoload_rte' => true, 'label' => $this->l('textarea'), 'name' => 'textarea', ) ), 'submit' => array( 'title' => $this->l('Save'), 'class' => 'btn btn-default pull-right', 'name' => 'submitForm2', ) ), ); $helper = new HelperForm(); $helper->show_toolbar = false; $helper->table = $this->table; $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 = 'submitModule'; $helper->module = $this; $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( 'currencies' => Currency::getCurrencies(), 'fields_value' => $this->getConfigFieldsValues(), 'languages' => $this->context->controller->getLanguages(), 'id_language' => $this->context->language->id ); return $helper->generateForm(array($fields_form_1, $fields_form_2)); [2] htmlspecialchars() expects parameter 1 to be string, array given I have 2 warrming!!! why ? Link to comment Share on other sites More sharing options...
pawelszulc Posted May 23, 2019 Share Posted May 23, 2019 On 6/6/2017 at 11:01 AM, Nishith said: Hi.. see this demo create a multiple form same configuration page public function renderForm() { $fields_form_1 = array( 'form' => array( 'legend' => array( 'title' => $this->l('Settings'), 'icon' => 'icon-cogs' ), 'input' => array( array( 'type' => 'text', 'label' => $this->l('text'), 'name' => 'text', ), array( 'type' => 'text', 'label' => $this->l('text2'), 'name' => 'text2', ), ), 'submit' => array( 'title' => $this->l('Save'), 'class' => 'btn btn-default pull-right', 'name' => 'submitForm1', ) ), ); $fields_form_2 = array( 'form' => array( 'legend' => array( 'title' => $this->l('Settings'), 'icon' => 'icon-cogs' ), 'input' => array( array( 'type' => 'textarea', 'autoload_rte' => true, 'label' => $this->l('textarea'), 'name' => 'textarea', ) ), 'submit' => array( 'title' => $this->l('Save'), 'class' => 'btn btn-default pull-right', 'name' => 'submitForm2', ) ), ); $helper = new HelperForm(); $helper->show_toolbar = false; $helper->table = $this->table; $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 = 'submitModule'; $helper->module = $this; $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( 'currencies' => Currency::getCurrencies(), 'fields_value' => $this->getConfigFieldsValues(), 'languages' => $this->context->controller->getLanguages(), 'id_language' => $this->context->language->id ); return $helper->generateForm(array($fields_form_1, $fields_form_2)); } Thanks [2] htmlspecialchars() expects parameter 1 to be string, array given I have 2 warrming!!! why ? 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