Thursday, November 22, 2012

Crazy little thing called dialog...


..today cost me a lot of nerves. I had a simple form and after every page submit, session state value of items were sequentially shifted (after page submit, value of first item become value of second item, value of second item become value of third item and so on...).

Initial form state

Form state after first submit

Form state after third submit

The first time after many years working with APEX I’ve got really pissed off. I’ve tried to isolate the problem, so I’ve deleted most of page items and had a form with only two items, with no processes, branches, dynamic actions...and it happened again – after submit, item values sequentially shifted. Then I’ve tried to create new page and all worked fine.

No matter what, I wanted to discover what’s the problem on the old page. After some time I got to POST request and found a clue. The items were submitted, but the sequence wasn’t right. I’ve got items posted in order from p_t02 to p_t03 and the p_t01 was missing. So I’ve opened FireBug and found it just before </BODY> HTML tag in jQuery UI Dialog. And the answer was here!


POST request

On page 0 there was a region (with “missing” item – p_t01) used for jQuery Dialog. After initialization of jQuery dialog, dialogs HTML was generated just before </BODY> HTML tag and the dialog region was pulled from its original position (inside <form id=” wwvFlowForm “> HTML tag) and moved just before the end of HTML body. As you may guess, only items inside <FORM> element are submitted to session state.

Quick solution of this problem was to put regions used for jQuery dialogs as last regions on page, so its items will get the last p_tXX values for name HTML attribute.

You can find test example here.

I hope that this post will help someone someday! :)

Edit on July 29, 2015:
More about this problem and order of submited items you can find here



4 comments:

  1. I just ran into the same issue and spent a considerable amount of time trying to debug it. I too looked through the POST but I did not connect the dots. I coincidentally moved some regions around and now it all makes sense. Good find!

    ReplyDelete
  2. That's why I've started to blog about this things. :)

    ReplyDelete
  3. Good thing you wrote about this. I spoke with Tyson today about this issue and Dan and I had the same problem a long time ago but I didn't write a post about it (I should have though): https://forums.oracle.com/forums/thread.jspa?messageID=3180532

    I wrote a plugin for simple dialog boxes in APEX to work around this issue: http://www.talkapex.com/2010/08/apex-plugin-simple-modal.html

    ReplyDelete
  4. cheap jimmy choo uk, combining elegant style and cutting-edge technology, a variety of styles of cheap men jimmy choo espradrilles , the pointer walks between your exclusive taste style.

    ReplyDelete