Jump to content

Form : 'select' type with NULL option


Recommended Posts

Hi !

 

I would like to know if in a form of a module (or in a controller)

$query = 'SELECT * FROM myTable';
$myQsqlQuery = Db::getInstance()->executeS($query);

$this->fields_form = [
    'input' => [
        [
            'name' => 'configure',
            'label' => $this->module->l('Configuration'),
            'type' => 'select',
            'options' => [
                'query' => $mySqlQuery,
                'id' => 'id',
                'name' => 'name'
            ]
        ]
    ],
    ...

If we can manage to have the possibility to select a NULL value.

Of course I don't want to create a row in my table entitled 'NULL'.

 

Thanks for your suggestions.

Link to comment
Share on other sites

  • ABCDino changed the title to Form : 'select' type with NULL option

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...