The problem is when success is false in the json_encode, I get errors, but it works OK when success is true.
So for example, this works OK, BUT the form fields are cleared (I assume because its success is true):
if($error)
{
echo "<textarea>".json_encode(array('success' => true , 'success_message' => 'This participant already exists'))."</textarea>";
$crud->set_echo_and_die();
}
If I use the following code (and use either success_message or error_message), I get a pop up message that says "An error occured on Saving"
if($error)
{
echo "<textarea>".json_encode(array('success' => false , 'error_message' => 'This participant already exists'))."</textarea>";
$crud->set_echo_and_die();
}
If I use the following code (to remove textarea), it just hangs (the animated loading image keeps going, no output)
if($error)
{
echo .json_encode(array('success' => false , 'error_message' => 'This participant already exists'));
$crud->set_echo_and_die();
}
So please could you tell me how do you output an error message to the screen when using callback_before_insert or callback_before_update?
Thanks