tommm Posted September 28, 2017 Share Posted September 28, 2017 I am using the Pre-Made form from the Module Generator I need either an On-Off Button or 2 radio buttons to select Live or Testing Mode. The button currently saves correctly as Null if Off, and 1 if On in the Configuration DB table. However the form always loads as "off" protected function getConfigForm() { return array( 'form' => array( 'legend' => array( 'title' => $this->l('Settings'), 'icon' => 'icon-cogs', ), 'input' => array( array( 'type' => 'switch', 'label' => $this->l('Live mode'), 'name' => 'REGISTRATIONSYNC_LIVE_MODE', 'is_bool' => true, 'desc' => $this->l('Use this module in live mode'), 'values' => array( array( 'id' => 'active_on', 'value' => true, 'label' => $this->l('Enabled') ), array( 'id' => 'active_off', 'value' => false, 'label' => $this->l('Disabled') ) ), ), ), 'submit' => array( 'title' => $this->l('Save'), ), ), ); } protected function renderForm() { $helper = new HelperForm(); $helper->show_toolbar = false; $helper->table = $this->table; $helper->module = $this; $helper->default_form_language = $this->context->language->id; $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG', 0); $helper->identifier = $this->identifier; $helper->submit_action = 'submitRegistrationSyncModule'; $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( 'fields_value' => $this->getConfigFormValues(), /* Add values for your inputs */ 'languages' => $this->context->controller->getLanguages(), 'id_language' => $this->context->language->id, ); return $helper->generateForm(array($this->getConfigForm())); //return $helper->generateForm(array($this->getConfigForm())); } protected function getConfigFormValues() { return array( 'REGISTRATIONSYNC_LIVE_MODE' => Configuration::get('REGISTRATIONSYNC_LIVE_MODE', true), ); } What's wrong with this, it is driving me nuts, Ive tried both the on off and radio... the on off button is pre-made in the module generator.. you would think it would just work Link to comment Share on other sites More sharing options...
tommm Posted September 28, 2017 Author Share Posted September 28, 2017 Well for anyone interested, the problem was in: Configuration::get('REGISTRATIONSYNC_LIVE_MODE', true) Changing this to Configuration::get('REGISTRATIONSYNC_LIVE_MODE') made it work I am interested in why if anyone cares to still respond 1 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