orclapex 5.x page validations (upgraded concept)
isabolic99 Jun 14 '17
First thing first, let me be clear this is observation post and some sort of solution approach. Last week I analyzed apex application which was created on apex 4.x and imported to apex 5. The application was imported successfully and I knew that I can't use universal theme features ( for example template options). Now for the interesting part and that is validation process/execution. This has changed in apex 5, but also for imported application it did not stayed in apex 4 "mode".
Here is the explanation:
Now in our application which was build on apex 4 we hided validation region and displayed validation using jquery jgrowl plugin after page submit.
when we migrate to apex 5, message where not displayed, and reason is AJAX call..
And the solution was that I changed code on page initialization (code snippet above) to this:
I applied callback on apex.messages before validation shows.
More about this can be actually found in apex JS DOCS
Also I found that on page login they used "old" approach, they render validation region, so setThemeHooks won't work here...
I did some thinking and came up with this scenario regarding apex js API:
You have apex 5 on development env. (because of faster development) and some old apex 4 production env. that for some reason it won't get upgrade in near feature. You use some specific apex JS API that is only available in apex 5 and you deployed that code to apex 4 production env. and then the fun starts :D
Big thanks to our poor organization, that we only support our clients directly on production... ;)