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

Display custom error message

error message Display custom

  • Please log in to reply
1 reply to this topic

#1 cksuperlatif



  • Members
  • Pip
  • 1 posts

Posted 04 December 2018 - 04:45 PM

Hello everybody,


Sorry for my English I'm french.


I want to display custom error message after checking data from another table.

Ex: 1). I have table 'application_profil' that contains each application and profile in it

      2). I want to check if the application and the profile that user submit exist in the table 'application_profil'

           if yes; insert into 'recensement_profil'  if no; display custom error message(this profile doesn't exist in this application)


My model:

class appli_model extends CI_Model  {
	public function __construct()
   public function checkappli_model($libelle_profil,$libelle_application)
       $this->db->select('Libelle_Profil, Libelle_Application');
       $query = $this->db->get();
       $result= $query->result();
       $count = count($result);

       return $count;



My controller:

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class applis extends CI_Controller {

    public function __construct()

    public function index()
            $crud = new grocery_CRUD();
            $crud->callback_before_insert(array($this,'_checkapplication',$crud ));

            $output = $crud->render();

        }catch(Exception $e){
            show_error($e->getMessage().' --- '.$e->getTraceAsString());


    function _checkapplication($post_array,$primary_key)
        $lipro =	$post_array['Libelle_Profil']	;
        $fkappli = 	$post_array['Libelle_Application'];
        $resultat = 	$this->appli_model->checkappli_model($lipro,$fkappli);

        if ($resultat==1)
                return true;
                $this->form_validation->set_message('Cet profil nexiste pas sur cette apllication');
                return False;


    public function _example_output($output = null)
        $userdataSession = $this->session->userdata('utilisateur');






#2 xuchunhua



  • Members
  • Pip
  • 1 posts

Posted 15 May 2019 - 02:46 AM

function test_callback($postArray, $primaryKey){
      print_r(json_encode(['success'=>false, 'error_message'=>'your message']));
修改 assets/grocery_crud/themes/flexigrid/js/flexigrid-edit.js
第70行 form_error_message(message_update_error);改成


Also tagged with one or more of these keywords: error, message, Display, custom

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users