Inside Oracle APEX by Patrick Wolf

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!

Labels: , , ,

11 Comments:

  • Ok, you did it ;-)
    Well done!

    By Blogger Dimitri Gielis, at 15 December, 2006 10:55  

  • Nice solution and explanation, thank you Patrick :)

    By Blogger Tonguç, at 15 December, 2006 11:42  

  • 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.

    By Anonymous Anonymous, at 15 December, 2006 20:31  

  • P.S. It works in IE70 as well.

    By Anonymous Anonymous, at 15 December, 2006 20:33  

  • 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

    By Blogger Patrick Wolf, at 16 December, 2006 22:23  

  • Patrick,

    This is really nice. Great work!

    Earl

    By Blogger earl.lewis, at 18 December, 2006 20:02  

  • Thanks Earl!

    By Blogger Patrick Wolf, at 18 December, 2006 22:52  

  • 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.

    By Blogger David, at 09 February, 2007 14:57  

  • 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

    By Blogger Patrick Wolf, at 09 February, 2007 15:08  

  • 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

    By Blogger Jules Verhoeven, at 16 March, 2007 21:56  

  • 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

    By Blogger Patrick Wolf, at 16 March, 2007 22:27  

Post a Comment

<< Home