There's an old joke that goes like this:
A man goes to the doctor and says, “Doctor, it hurts when I bend my arm like this.” To which the doctor responds, “Well, don't bend your arm like that.”
(I didn't say it was a good joke…) What's this got to do with APEX? I'm glad you asked!
When I was building the mobile interface for WriteTrack, I kept the same approach I'd used in the normal version–a challenge selector on the global page, so that the users can change what challenge they're looking at wherever they happen to be. Turns out this doesn't work.
APEX 4.2 introduced the ability to have multiple user interfaces in the same application, which is very cool (at this point, that basically boils down to desktop and mobile, of course). To set this up, go to the Edit Application Properties page, click on the User Interface tab, and scroll down to the bottom. You'll see a big button labeled “Add New User Interface”. Click it and go through the wizard. (Incidentally, there's a bug in 4.2.0; it will ignore any changes you make and just use the defaults, so don't panic when that happens.)
The wizard will create three pages for you in the new UI–a mobile login page (defaults to 1001); a mobile home page (defaults to the first available non-zero page number); and a mobile global page (page 0 if you don't already have one, otherwise page 999). These are normal, fully functional APEX pages, and you can do whatever you want with them. For WriteTrack, I deleted the first two auto-generated pages and built my own, so that I could control which page numbers they had; the important thing to remember if you do this is to keep the page aliases.
The problem I ran into, though, came up when I added a page item to page 999. If you try to submit a mobile page which has an item from page 999 on it, you get an error: “Item ID (….) is not an item defined on the current page.” Also, the APEX Advisor doesn't seem to recognize the possibility of having multiple global pages, but that's a minor issue.
When I asked one of my co-workers (the one in charge of the development of the mobile feature), his response was basically, “don't do that.” The root reason is that the mobile pages are rendered differently from desktop pages–they're pumped through AJAX, rather than being totally fresh pages with their own DOM models–so global page items cause confusion.
So, be careful of global pages. Branches on page 0 have never worked, and page items on the mobile global page will just cause you painful errors.
Leave a Reply