I have a custom save function in a class that is extending JModelAdmin.
The save function calls several external functions in other helper files.
At several points those helper files can indicate that there is an error and do a 'return false' which then causes the save to fail. That is working.
When this happens Joomla nicely displays
"Save failed with the following error: "
at the top of the form.
What I'm not sure is how to properly get the 'reason' back to the parent save function so that it will display the error notice after that notice.
So far the only thing that I've been able to do is within the helper file add the line:
JFactory::getApplication()->enqueueMessage(JText::sprintf('Your %s file is not the proper format type.',$typeName),'error');
right before the
return false;
line within the helper file.
The problem is that this is displayed ABOVE the save failure notice, resulting in
Your image file is not the proper format type.
Save failed with the following error:
Which is in the wrong order.
Is there a way that I can 'push' the error type back to the calling save function (and back to the base save function) and display my error in the proper order UNDER the 'following error:' message?