Jump to content

Form selector with empty array


Recommended Posts

Hi,

 

I have a form with a select field.

I want to set this field empty.

 

This is the definition of the field in the form :

array(
                            'type' => 'select',
                            'name' => 'PROMOTDU_SUPPR',
                            'required' => true,
                            'label' => $this->l('Liste des promotions actives : '),
                            'options' => array(
                                'query' => $options,
                                'id' => 'id',
                                'name' => 'name' 
                              )
                        ),

I want $options empty so, I wrote this before :

$options[] = array();

But I have 2 errors :

undefined index : id

undefined index : name

 

Thanks for your help :)

 

Link to comment
Share on other sites

Hi..

use like this
 

$options = array(array('id' => '', 'name' => ''));


array(
      'type' => 'select',
      'name' => 'PROMOTDU_SUPPR',
      'required' => true,
      'label' => $this->l('Liste des promotions actives : '),
      'options' => array(
          'query' => $options,
          'id' => 'id',
          'name' => 'name' 
        )
),

Thanks

Link to comment
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
×
×
  • Create New...