⚠ 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 is an archived forum. ⚠

  •     

profile picture

How to display alert message on page rather than a pop-up



latearrival

latearrival
  • profile picture
  • Member

Posted 31 August 2016 - 00:12 AM

Hi.

 

I have a question about where messages are displayed.

 

I have three callbacks that do some BEFORE validation & return FALSE if the validation fails:

 

$this->grocery_crud->callback_before_delete(array($this,'detect_contact_delete_failure')); 
$this->grocery_crud->callback_before_update(array($this, 'detect_contact_update_failure'));
$this->grocery_crud->callback_before_insert(array($this, 'detect_contact_insert_failure'));

 

I am displaying custom error messages like this:

 

$this->grocery_crud->set_lang_string('delete_error_message', "You can't delete this Contact because bla bla bla...");
$this->grocery_crud->set_lang_string('update_error', "You can't update this Contact because bla bla bla...");
$this->grocery_crud->set_lang_string('insert_error', "You can't add this Contact because bla bla bla...");

 

The delete_error_message message appears on the page, above the table. This is perfect.

 

mim93q.png

 

The update_error and insert_error messages are shown as pop-up boxes, like this:

 

erbim9.png

 

 

I would really like form validation error messages to be displayed on the form (e.g. where the field-validation alerts appear), not on as a pop-up box.

 

2s5xooh.png

 

Is there an easy way for a GC/CI beginner like me to display the update_error and insert_error messages on the form rather than as a pop-up box?

 

Thanks!

Dave.