Hacking the APEX error page!


Do you like the separate APEX error page which is called when APEX raises an error (eg in the MRU/MRD process for tabular forms)? If yes, you don’t have to read further, if your answer is NO you may should read the rest of this posting…

Wouldn’t it be cool and much user friendlier to have this error message displayed as inline message, as we can do it for validation processes? You thought that’s not possible, because when the page is re-rendered, all the changes in the tabular form are lost… It is possible!


Yesterday I had an idea and did a “little” (ok it took a little bit longer, because I’m a newbie in JavaScript :-) ) hacking and finally came up with a solution which you just plug into our application and all error messages which normally displayed in the separate error page are now displayed as inline message, without re-rendering and loosing your entered data.

But first try out the following examples.

Standard Tabular Form example with old error handling

After you have done that, check out my

Enhanced Tabular Form example with inline error messages.

Isn’t that cool? :-)

How to integrate it into your application?

Follow the steps in my How to integrate posting.

Vola, that’s it! If an error message is displayed now on the APEX error page, the text will be extracted and pasted into the caller page.

See also

Hacking APEX error page – part 2

I’m new to JavaScript programming, so if you see “some errors/you don’t do that in JavaScript”, please let me know. I would appreciate that!

Or if you have any other suggestions or problems, don’t hesitate to drop me a note. I haven’t done a lot of testing yet, but it seems to work fine with FireFox 2.0 and IE 6.0.

Don’t forget to check out the other ApexLib framework solutions!

14 thoughts on “Hacking the APEX error page!

  1. Nice work.
    Recommend
    1. You display a generic error message to user, like “there was an error contact administrator”
    2. Log the entire error message into an error log table.

  2. Hi,

    > You display a generic error message to user,
    > like “there was an error contact administrator”
    > 2. Log the entire error message into an
    > error log table.

    the error page can’t decide if it’s a sever error or if it’s a error raised by a validation process. If I always replace the error by a generic error, I assume the administrator wouldn’t be to happy ;-)

    That’s the wrong place to put such code. What we really need is an application/page level event which fires when an error occurs where we have the possibility to change and log the error message.

    For example in our company we are unable to use all the features of our PL/SQL exception handling package (which builds an call stack with all the input variables for error tracking) when used with APEX, because there is no event where we can call our “format final stack” function. :-(

    I really hope that we are getting such an entry point in APEX V3.0.

    Patrick

  3. Excellent stuff will intergrate in current project. You may want to know that the error just flashes up in Opera before disapearing
    Version 9.02
    Build – 8585
    Platform – Win32
    System – Windows XP
    Java – Sun Java Runtime Environment version 1.5

    Hope this helps.

  4. Hi David,

    thanks for letting me know. I think it depends on the PC speed and the browser. I also see it randomly with Firefox. I have already logged a bug for that issue and will probably fix it in the next release.

    I think the solution is to add a “display:none”, to hide the error on the error page.

    Patrick

  5. Hi Patrick

    What username and password should I use, to see the code in the examples on this page ?

    I’m learning the most by seeing some code.

    Thanks

  6. Hi Jules,

    the Demo Application is included in the ApexLib distribution. It’s in the Examples directory and you can load it into your own workspace.

    Patrick

  7. Hi Patrick,

    Thanks for your great ApexLib! Still I have a problem. When I have a database error (ie. raised by a trigger in the db), the screen flashes with the (old style) error and the normal page will be shown. When I debug in Apex, I can see the error (also in old apex-style). Other error messages like inline messages work fine. What did I wrong?
    Thanks for your help!

  8. Hi Patrick

    This looks great. How do you change the color and boldface a record in a table based on a certain status setting. Any assistance will be greatly appreciated. I can be contacted at jacques.schalkwyk@finfreeadmin.com
    Best regards
    Deep darkest africa

  9. Hi Jacques,

    have a look at the report templates (Shared Components) and there at the “column template” setting. Use the “Standard, Alternating Row Colors” as an example where you see how the conditions work.

    Best Regards
    Patrick

Comments are closed.