⚠ In case you've missed it we are migrating to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. Very soon this forum will be read-only and archived. ⚠


Error loading saving data


  • Please log in to reply
No replies to this topic

#1 Phd2000

Phd2000

    Newbie

  • Members
  • Pip
  • 1 posts

Posted 25 March 2021 - 08:58 AM

Hello everyone

 

I'm newbee to coding and I recently discovered Grocery Crud and would like to start a small project.

I have install Grocery Crud Ver 2.01 and Codelgniter  Ver 4.1.1 in local with Wampserver

I want to capitalize the field  « nom_ta_client” in my database but I always have the error “Loading saving data” and if I remove the 2 lines with Callback  all is good no mistake.

Could someone tell me where I made a mistake

Thank you for your help and sorry for my poor English

 

 

 

{
public function prepare($post_array)
{
$post_array['nom_ta_client'] = strtoupper(trim($post_array['nom_ta_client']));        
return $post_array;
}

function get_init_date($post_array)
{
  $post_array['date_creation_ta_client'] = date('d-m-Y');
  $post_array['date_maj_ta_client'] = date('d-m-Y H:i:s');
  return $post_array;
}

 function Client() {
        $crud = new GroceryCrud();

        $crud->setTheme('datatables');

        $crud->setTable('ta_client');

        $crud->columns([
                        'date_creation_ta_client',
                        'date_maj_ta_client',
                        'titre_ta_client',
                        'nom_ta_client',
                        'prenom_ta_client'    
                        ]);

        $crud->setSubject('CLIENT');

        $crud->displayAs('date_creation_ta_client','Date de Création');
        $crud->displayAs('date_maj_ta_client','Date de MAJ');
        $crud->displayAs('titre_ta_client','Titre');
        $crud->displayAs('nom_ta_client','Nom');
        $crud->displayAs('prenom_ta_client','Prénom');

        $crud->requiredFields(['nom_ta_client']);

        $crud->fieldtype('titre_ta_client','enum',array('Mr','Mme','Mlle'));

        $crud->callbackbeforeinsert(array($this,'prepare'));
        $crud->callbackbeforeupdate(array($this,'prepare'));
        
        $crud->setRead();

        $crud->fieldtype('date_creation_ta_client','invisible');
        $crud->fieldtype('date_maj_ta_client','invisible');
        
        $output = $crud->render();

        return $this->_TestOutput($output);
    }

    private function _TestOutput($output = null) {
        return view('Test', (array)$output);
    }
}

 

 

 

Attached Thumbnails

  • Capture.PNG





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users