Welcome Guest, Not a member yet? Register   Sign In
How insert null on save in select field
#3

(This post was last modified: 10-26-2021, 09:10 AM by mlurie.)

In your model, create the following method:

PHP Code:
protected function setDefaultIDMezzi(array $data) {
    if(!isset($data['data']['id_mezzi']))
        $data['data']['id_mezzi'] = NULL;
    return $data;


You must then configure your model to call this method before each insert (and update if desired) by including these protected variables:

PHP Code:
protected $beforeInsert = ['setDefaultIDMezzi'];
protected 
$beforeUpdate = ['setDefaultIDMezzi']; 

Please review the documentation to make sure you completely understand: https://codeigniter.com/user_guide/model...your-model.
Reply


Messages In This Thread
RE: How insert null on save in select field - by mlurie - 10-26-2021, 08:35 AM



Theme © iAndrew 2016 - Forum software by © MyBB