title: Prestashop checkbox check
body: <p>I want to know how a checkbox in module page can be made checked
  My code is :-</p>
  
  <pre><code>if (!defined('_PS_VERSION_')) {
  exit;
  }
  class ExportOrders extends Module
  {
  
      protected $config_form = false;
      protected $_html = '';
      protected $_postErrors = array();
  
      public function __construct()
      {
      $this-&gt;name = 'exportorders';
      $this-&gt;tab = 'export';
      $this-&gt;version = '1.0.1';
      $this-&gt;author = 'Decathlon Sports India Limited';
      $this-&gt;need_instance = 1;
  
      /**
      * Set $this-&gt;bootstrap to true if your module is compliant with bootstrap (PrestaShop 1.6)
      */
      $this-&gt;bootstrap = true;
  
      parent::__construct();
  
      $this-&gt;displayName = $this-&gt;l('ExportOrders');
      $this-&gt;description = $this-&gt;l('generating xml for exportorder based on manual and automation process');
  
      $this-&gt;confirmUninstall = $this-&gt;l('Are you sure you want to uninstall the module');
  }
  
  /**
  * Don't forget to create update methods if needed:
  * http://doc.prestashop.com/display/PS16/Enabling+the+Auto-Update
  */
  public function install()
  {
      if (!parent::install() OR ! $this-&gt;alterTable('add') OR ! $this-&gt;registerHook('actionAdminControllerSetMedia') OR ! $this-&gt;registerHook('actionProductUpdate') OR ! $this-&gt;registerHook('displayAdminProductsExtra'))
      return false;
      return true;
  }
  
  public function uninstall()
  {
      if (!parent::uninstall() OR ! $this-&gt;alterTable('remove'))
      return false;
      return true;
  }
  
  public function alterTable($method)
  {
      switch ($method) {
      case 'add':
      $sql = 'ALTER TABLE ' . _DB_PREFIX_ . 'order_history ADD `export_orders` int NOT NULL';
      break;
  
      case 'remove':
      $sql = 'ALTER TABLE ' . _DB_PREFIX_ . 'order_history DROP COLUMN `export_orders`';
      break;
  }
  
  if (!Db::getInstance()-&gt;Execute($sql))
  return false;
  return true;
  }
  
  /**
  * Load the configuration form
  */
  public function prepareNewTab()
  {
  
      $this-&gt;context-&gt;smarty-&gt;assign(array(
      'custom_field' =&gt; '',
      'languages' =&gt; $this-&gt;context-&gt;controller-&gt;_languages,
      'default_language' =&gt; (int)Configuration::get('PS_LANG_DEFAULT')
      ));
  
  }
  /**
  * Validating the settings form
  */
  protected function _postValidation()
  {
  
      if (Tools::isSubmit('submitexportordersModule'))
      {
      // if (!Tools::getValue('Order Id'))
      //     $this-&gt;_postErrors[] = $this-&gt;l('Order Id is mandatory.');    
      if (!Tools::getValue('EXPORTORDERS_LOCATION'))                
      $this-&gt;_postErrors[] = $this-&gt;l('Export Location is required.');
  
  
  }
  }
  
  public function getContent()
  {
      /**
      * If values have been submitted in the form, process.
      */
      if (((bool)Tools::isSubmit('submitexportordersModule')) == true){ 
  
      $this-&gt;_postValidation();
      if (!count($this-&gt;_postErrors))
      $this-&gt;postProcess();
      else
      foreach ($this-&gt;_postErrors as $err)
      $this-&gt;_html .= $this-&gt;displayError($err);
  }
  else
  $this-&gt;_html .= '&lt;br /&gt;';
  
  $this-&gt;_html .= $this-&gt;renderForm();
  
  return $this-&gt;_html;
  
  $this-&gt;context-&gt;smarty-&gt;assign('module_dir', $this-&gt;_path);
  
  $output = $this-&gt;context-&gt;smarty-&gt;fetch($this-&gt;local_path.'views/templates/admin/configure.tpl');
  return $output.$this-&gt;renderForm();
  }
  
  /**
  * Create the form that will be displayed in the configuration of your module.
  */
  protected function renderForm()
  {
      $helper = new HelperForm();            
  
      $helper-&gt;show_toolbar = false;
      $helper-&gt;table = $this-&gt;table;
      $helper-&gt;module = $this;
      $helper-&gt;default_form_language = $this-&gt;context-&gt;language-&gt;id;
      $helper-&gt;allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG', 0);
  
      $helper-&gt;identifier = $this-&gt;identifier;
      $helper-&gt;submit_action = 'submitexportordersModule';
      $helper-&gt;currentIndex = $this-&gt;context-&gt;link-&gt;getAdminLink('AdminModules', false)
      .'&amp;configure='.$this-&gt;name.'&amp;tab_module='.$this-&gt;tab.'&amp;module_name='.$this-&gt;name;
      $helper-&gt;token = Tools::getAdminTokenLite('AdminModules');
  
      $helper-&gt;tpl_vars = array(
      'fields_value' =&gt; $this-&gt;getConfigFormValues(), /* Add values for your inputs */
      'languages' =&gt; $this-&gt;context-&gt;controller-&gt;getLanguages(),
      'id_language' =&gt; $this-&gt;context-&gt;language-&gt;id,
      );
  
      $helper-&gt;fields_value[OrderID] = true;
      return $helper-&gt;generateForm(array($this-&gt;getConfigForm()));
  }
  
  /**
  * Create the structure of your form.
  */
  protected function getConfigForm()
  {
      return array(
      'form' =&gt; array(
      'legend' =&gt; array(
      'title' =&gt; $this-&gt;l('Settings'),
      'icon' =&gt; 'icon-cogs',
      ),
      'input' =&gt; array(
  
      array(
      'type' =&gt; 'checkbox',
      'label' =&gt; $this-&gt;l('Select Required Options'),                        
      // 'required' =&gt; true,
      'values' =&gt; array(
      'query' =&gt; array(
      array(
      'id' =&gt; 'AllFields',
      'name' =&gt; $this-&gt;l('All Fields'),                                
      'val' =&gt; 'All', 
      'class' =&gt; 'check_all',
      ),
      array(
      'id' =&gt; 'OrderID',  
      'name' =&gt; $this-&gt;l('Order Id'),                                
      'val' =&gt; 1,
      'required' =&gt; true,                                    
      'class' =&gt; 'order_id',
      ), array(
      'id' =&gt; 'InvoiceNo',
      'name' =&gt; $this-&gt;l('Invoice No'),
      'val' =&gt; 1,
      ), array(
      'id' =&gt; 'ShippedDate',
      'name' =&gt; $this-&gt;l('Shipped Date'),
      'val' =&gt; 1,
      ), array(
      'id' =&gt; 'PaymentMethod',
      'name' =&gt; $this-&gt;l('Payment Method'),
      'val' =&gt; 1,
      ), array(
      'id' =&gt; 'TransportCost',
      'name' =&gt; $this-&gt;l('Transport Cost'),
      'val' =&gt; 1,
      ), array(
      'id' =&gt; 'OrderStatus',
      'name' =&gt; $this-&gt;l('Order Status'),
      'val' =&gt; 1,
      ), array(
      'id' =&gt; 'MyDecathlonId',
      'name' =&gt; $this-&gt;l('Decathlon Id'),
      'val' =&gt; 1,
      ), array(
      'id' =&gt; 'FirstName',
      'name' =&gt; $this-&gt;l('First Name'),
      'val' =&gt; 1,
      ), array(
      'id' =&gt; 'LastName',
      'name' =&gt; $this-&gt;l('Last Name'),
      'val' =&gt; 1,
      ), array(
      'id' =&gt; 'Address1',
      'name' =&gt; $this-&gt;l('Address1'),
      'val' =&gt; 1,
      ), array(
      'id' =&gt; 'Address2',
      'name' =&gt; $this-&gt;l('Address2'),
      'val' =&gt; 1,                                   
      'id' =&gt; 'State',
      'name' =&gt; $this-&gt;l(' State'),
      'val' =&gt;1,
      ), array(
      'id' =&gt; 'ZipCode',
      'name' =&gt; $this-&gt;l(' ZipCode'),
      'val' =&gt;1,
      ), array(
      'id' =&gt; 'Phone',
      'name' =&gt; $this-&gt;l('Phone'),
      'val' =&gt; 1,
      ), array(
      'id' =&gt; 'Email',
      'name' =&gt; $this-&gt;l('Email'),
      'val' =&gt; 1,
      ), array(
      'id' =&gt; 'Item',
      'name' =&gt; $this-&gt;l('Item'),
      'val' =&gt; 1,
      ), array(
      'id' =&gt; 'QuantityOrdered',
      'name' =&gt; $this-&gt;l('Quantity Ordered'),
      'val' =&gt; 1,
      ), array(
      'id' =&gt; 'QuantityReturned',
      'name' =&gt; $this-&gt;l('Quantity Returned'),
      'val' =&gt; 1,
      ), array(
      'id' =&gt; 'GrossAmount',
      'name' =&gt; $this-&gt;l('Gross Amount'),
      'val' =&gt; 1,
      ), array(
      'id' =&gt; 'NetAmount',
      'name' =&gt; $this-&gt;l('Net Amount'),
      'val' =&gt; 1,
      ), array(
      'id' =&gt; 'TaxRate',
      'name' =&gt; $this-&gt;l('Tax Rate'),
      'val' =&gt; 1,
      ), array(
      'id' =&gt; 'Currency',
      'name' =&gt; $this-&gt;l('Currency'),
      'val' =&gt; 1,                                    
      ),
      ),
      'id' =&gt; 'id',
      'name' =&gt; 'name'
      ),
      ),
  
  
      array(
      'type' =&gt; 'text',
      'name' =&gt; 'EXPORTORDERS_LOCATION',
      'label' =&gt; $this-&gt;l('Export Location'),
      'required' =&gt; true
      ),
      ),
      'submit' =&gt; array(
      'title' =&gt; $this-&gt;l('Save'),
      ),
      ),
      );
  
  }
  
  /**
  * Set values for the inputs.
  */
  protected function getConfigFormValues()
  {
      return array(
      'EXPORTORDERS_LOCATION' =&gt; Configuration::get('EXPORTORDERS_LOCATION'),
  
      );
  }
  
  
  /**
  * Save form data.
  */
  protected function postProcess()
  {
      //Initialise arrays and values
      $form_values = $this-&gt;getConfigFormValues();
      $_POST['module_name'] = 'export_orders';
  
      $arr = array_map('utf8_encode', $_POST);
      $test = json_encode($arr);       
      $insertData = array(
      'name'  =&gt; $_POST['module_name'], 
      'date_add'  =&gt; date('Y-m-d H:i:s'), 
      'value'  =&gt; $test
  
      );
      $updateData = array(   
      'date_upd'  =&gt; date('Y-m-d H:i:s'),      
      'value'  =&gt; $test
  
      );
  
      //Fetch from configuration table
      $sql = 'SELECT * FROM '._DB_PREFIX_.'configuration WHERE name = "export_orders"';
  
      if ($row = Db::getInstance()-&gt;getRow($sql))
      $decoded_values = json_decode($row['value']);
  
      if($decoded_values == ""){
  
      Db::getInstance()-&gt;insert("configuration", $insertData);
  
  }
  else 
  
  Db::getInstance()-&gt;update('configuration', $updateData, 'name = "export_orders"');
  foreach (array_keys($form_values) as $key) {
  // Configuration::updateValue($key, Tools::getValue($key));
  
  }
  }
  
  /**
  * Add the CSS &amp; JavaScript files you want to be loaded in the BO.
  */
  public function hookBackOfficeHeader()
  {
      if (Tools::getValue('module_name') == $this-&gt;name) {
      $this-&gt;context-&gt;controller-&gt;addJS($this-&gt;_path.'views/js/back.js');
      $this-&gt;context-&gt;controller-&gt;addJS($this-&gt;_path.'views/js/back_checkall.js');
      $this-&gt;context-&gt;controller-&gt;addCSS($this-&gt;_path.'views/css/back.css');
  }
  }
  
  /**
  * Add the CSS &amp; JavaScript files you want to be added on the FO.
  */
  public function hookHeader()
  {
      $this-&gt;context-&gt;controller-&gt;addJS($this-&gt;_path.'/views/js/front.js');
      $this-&gt;context-&gt;controller-&gt;addCSS($this-&gt;_path.'/views/css/front.css');
  }
  
  public function hookDisplayBackOfficeHeader()
  {
      /* Place your code here. */
  }
  
  public function hookDisplayBackOfficeHome()
  {
      /* Place your code here. */
  }
  }
  </code></pre>
  
  <p>Also want to know how i can make select all to select all checkboxes. I have tried lot cant succeed, please help me</p>
  
  <p>I had tried the checkbox to be checked but it is not getting right</p>