7 years ago


  I update some fields by called PHP script with afterstore method. Into PHP file I have some complex controls on data entered by user. I want display an error message to inform user on reason on error, witch field must be corrected and so on... Is exist a method ? I think to add a custom field and display it if it is filled by PHP script but I don't sure that it is the best solution. 

In the same way, if the error is encountered into a PHP script called by beforeStore, how I can cancel the save procedure by Seblod ?

Thank you in advance for your answer.


Get a VIP membership
4229 Posts
7 years ago
Level 1

In beforeStore try something like this:

$app    =  JFactory::getApplication();

$alert =  JText::_( 'COM_CCK_ALERT_SOMETHING') ;

$app->enqueueMessage( $alert, 'error' );
$config['validate']    =  'error';

I after store  values are already stored to database and throwing errors there the makes no sense.

7 years ago
Level 2

Hi Klas,

 I'm Ok with you the code must be used into BeforeStore. It's Ok with your code, modification are not recorded and error message is displayed. Nevertheless the message "Successfully saved" is also displayed, as the form has been saved. It is very confusing. I haven't found how I can remove this message and have only the error message.

Thank you in advance for your help.


Get a VIP membership