diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index ae0e59426b2..1a91f1eca4b 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -697,8 +697,10 @@ if (empty($reshook)) { $result = $objectline->update($user); if ($result < 0) { - dol_print_error($db); - exit; + // Surface validation errors (e.g. mandatory extrafield left empty) as an + // event message on the same page instead of breaking with a full Dolibarr + // error screen that loses the user's edit context. + setEventMessages($objectline->error, $objectline->errors, 'errors'); } // Define output language