Jump to content

[Solved] helperForm et radioButton


Croonical
 Share

Recommended Posts

Bonjour à tous,

 

J'ai un gros problème avec le helperForm utilisé dans le displayForm de mon module. J'essaye en sorte de faire apparaître des radioButton avec seulement deux choix possibles, mais l'affichage qui en résulte pose véritablement problème :

 

797594helperform.png

 

 

Voici mon code :

 

public function displayForm()
{
 $default_lang = (int)Configuration::get('PS_LANG_DEFAULT');

 $fields_form[0]['form'] = array(
  'legend' => array(
'title' => $this->l('Settings'),
  ),
  'input' => array(
array(
 'type' => 'text',
 'label' => $this->l('Apikey'),
 'name' => 'APIKEY',
 'size' => 20,
 'required' => true
),
array(
 'type' => 'text',
 'label' => $this->l('Pin Code'),
 'name' => 'PINCODE',
 'size' => 20,
 'required' => true
),
array(
 'type' => 'text',
 'label' => $this->l('URL'),
 'name' => 'URL',
 'size' => 20,
 'required' => true
),
array(
 'type' => 'radio',
 'label' => $this->l('Site'),
 'name' => 'checkboxURL',
 'values' => array(								
  array(
	'id' => 'prod',
	'value' => 1,
	'label' => $this->l('Production')
  ),
  array(
	'id' => 'test',
	'value' => 0,
	'label' => $this->l('Test')
  )
   ),
  'is_bool' => true,						  
 'required' => true
)
  ),
  'submit' => array(
'title' => $this->l('Save'),
'class' => 'button'
  )
 );

 $helper = new HelperForm();

 $helper->module = $this;
 $helper->name_controller = $this->name;
 $helper->token = Tools::getAdminTokenLite('AdminModules');
 $helper->currentIndex = AdminController::$currentIndex.'&configure='.$this->name;

 $helper->default_form_language = $default_lang;
 $helper->allow_employee_form_lang = $default_lang;

 $helper->title = $this->displayName;
 $helper->show_toolbar = true;		// false -> remove toolbar
 $helper->toolbar_scroll = true;	  // yes - > Toolbar is always visible on the top of the screen.
 $helper->submit_action = 'submit'.$this->name;
 $helper->toolbar_btn = array(
  'save' =>
  array(
'desc' => $this->l('Save'),
'href' => AdminController::$currentIndex.'&configure='.$this->name.'&save'.$this->name.
'&token='.Tools::getAdminTokenLite('AdminModules'),
  ),
  'back' => array(
'href' => AdminController::$currentIndex.'&token='.Tools::getAdminTokenLite('AdminModules'),
'desc' => $this->l('Back to list')
  )
 );

 return $helper->generateForm($fields_form);
}

 

Savez-vous comment résoudre mon problème ?

 

Merci d'avance !

 

PS : Whoops, i didn't see i was on the english forum.

Edited by Croonical (see edit history)

Share this post


Link to post
Share on other sites

Try:

array(
        'type' => 'radio',
        'label' => $this->l('Site'),
        'name' => 'checkboxURL',
        'class' => 't',
        'values' => array(                                                             
         array(
               'id' => 'prod',
               'value' => 1,
               'label' => $this->l('Production')
         ),
         array(
               'id' => 'test',
               'value' => 0,
               'label' => $this->l('Test')
         )
          ),
         'is_bool' => true,                                              
        'required' => true
       )

  • Like 2

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More