Friday, July 31, 2009

Multiple tabular forms on one Apex page

As you probably know, you cannot have multiple tabular forms on one Apex page. One way around this limitation is to create your own reports and processes. This is described in Denes Kubicek's multiple tabular forms example.

But you can also trick your application to make it look like two tabular forms are on the same page.



This page actually consists of two pages. The form at the bottom is defined on another page. By using an iframe, this 2nd page is displayed on the same page as the form at the top.

Start by creating a normal tabular form page. Nothing special there.

Create a second page as a new blank page.
Change the template to Printer friendly. This way nothing extra will be shown on the page.

Now you can add the tabular form region as you would normally do. Make sure that the submit and cancel buttons branch back to the page you are now creating. This is important. There should be no way to go to any other page from this page. Otherwise, you are going to be stuck on the wrong page in the iframe.

Go back to the first page and create a HTML region on this page. Change the Region source to something like this:



9 comments:

  1. Very good example. Only trick is to script this to make iframe resizeable according to content. Other then that - it works perfectly.

    ReplyDelete
  2. Hi again
    I have just found it.
    You need to modify iframe tag like this:
    [iframe src="f?p=&APP_ID.:45:&APP_SESSION." frameborder="0" scrolling="auto" id="ifr" name="ifr" onload="this.style.height = ifr.document.body.scrollHeight + 5; this.style.width = ifr.document.body.scrollWidth + 5"]
    [/iframe]

    And the iframe will be sized according to the content. Tested on IE 8, FF 3.6.10 and Chrome 6.0.472.63.

    ReplyDelete
  3. Jaredj, thanks for that addition.

    ReplyDelete
  4. How can I make all the sections submit with one button

    ReplyDelete
  5. FOr APEX 4.1 and new application is necassary set Security atribute "Embeded in Frame" !

    ReplyDelete
  6. I did it but in my first page it shows empty white region :/

    ReplyDelete
  7. Even i am getting the empty white region :(

    ReplyDelete
  8. How can I pass values to Tabular form column created through iframe.

    Appreciate your quick response

    ReplyDelete