Build Custom Popup Pages in Oracle Application Express (formerly HTML DB)
Author: Raj Mattamal
After completing this How-To, you should understand:
Although HTML DB allows application developers to declaratively add popup list of value (popup LOV) items to their pages, occasionally application design requires developers to create custom popup pages. This how to describes the steps to create such a custom popup page with some advanced functionality.
The example described in this how to adds a custom popup LOV to a form on the SCOTT.EMP table. Clicking the popup LOV link on the form page will popup an LOV page that allows users to search by ENAME, JOB, and SAL. Selecting a value from this LOV page will close that popup LOV page and populate the ENAME, JOB, and SAL fields on the form page with the selected values. Additionally, had the user entered some data into the ENAME, JOB, and/or SAL fields on the form page, that data would be used in the initial search when the popup LOV page is first shown.Step 1 - Create a simple form page on SCOTT.EMP
To create the form page, simply step through the HTML DB "Form on a Table or View" wizard against the EMP table accepting the defaults. For this example, create the form with a page number of one, and make sure to allow the ename, job, and sal fields to be editable. When the wizard completes, page 1 of the application should have the items P1_ENAME, P1_JOB, and P1_SAL on it as text fields.Step 2 - Create a popup page with search fields
Step 4 - Add a popup link next to the P1_SAL field on the form page
Add a link to the form page that will call the callMyPopup function above and pass it the values it needs. To do so, place the following HTML in the "Post Element Text" field attribute of the P1_SAL item:
Step 5 - Add the LOV report to the popup page
select ename, job, sal , 'placeholder' the_link from emp where ename like '%'||:P2_ENAME||'%' and (job = :P2_JOB or :P2_JOB is null) and (sal = :P2_SAL or :P2_SAL is null)
Note that the last column in this query is just a placeholder. once the region is created, turn that placeholder into a link by doing the following:
Step 7 - Polishing
Discuss this how-to in the Oracle HTML DB Discussion Forum .