Edit D:\app\Administrator\product\11.2.0\dbhome_1\apex\images\doc\bldapp_frm_manual.htm
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=us-ascii" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <meta http-equiv="Content-Script-Type" content="text/javascript" /> <title>Creating a Form Manually</title> <meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1" /> <meta name="date" content="2009-04-14T16:11:29Z" /> <meta name="robots" content="noarchive" /> <meta name="doctitle" content="Creating a Form Manually" /> <meta name="relnum" content="Release 3.2" /> <meta name="partnum" content="E11947-01" /> <link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" /> <link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" /> <link rel="contents" href="toc.htm" title="Contents" type="text/html" /> <link rel="up" href="preface.htm" title="Home" type="text/html" /> <link rel="up" href="app_comp.htm" title="Adding Application Components" type="text/html" /> <link rel="up" href="bldapp_frm.htm" title="Creating Forms" type="text/html" /> <link rel="up" href="bldapp_frm_manual.htm" title="Creating a Form Manually" type="text/html" /> <link rel="prev" href="bldapp_frm_detail.htm" title="Previous" type="text/html" /> <link rel="next" href="bldapp_frm_val.htm" title="Next" type="text/html" /> </head> <body> <p id="BREADCRUMBING"><a href="preface.htm" title="Home">Home</a> > <a href="app_comp.htm" title="Adding Application Components">Adding Application Components</a> > <a href="bldapp_frm.htm" title="Creating Forms">Creating Forms</a> > Creating a Form Manually</p> <table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%"> <col width="86%" /> <col width="*" /> <tr valign="bottom"> <td align="left"></td> <td align="center"><a href="bldapp_frm_detail.htm"><img src="dcommon/gifs/leftnav.gif" alt="Previous" /><br /> <span class="icon">Previous</span></a> </td> <td align="center"><a href="bldapp_frm_val.htm"><img src="dcommon/gifs/rightnav.gif" alt="Next" /><br /> <span class="icon">Next</span></a></td> </tr> </table> <p><a id="CHDGFCGB" name="CHDGFCGB"></a></p> <div class="sect2"><!-- infolevel="all" infotype="General" --> <h1><a name="HTMDB05031|form, manual"></a>Creating a Form <a id="sthref1077" name="sthref1077"></a>Manually</h1> <p>You can also create a form manually by performing the following steps:</p> <ul> <li> <p>Create an HTML region (to serve as a container for your page items)</p> </li> <li> <p>Create items to display in the region</p> </li> <li> <p>Create processes and branches</p> </li> </ul> <p>To create a form manually by creating and HTML region:</p> <ol> <li> <p>Navigate to the appropriate Page Definition. See <a href="bldr_goto_pgdef.htm#CJGHCACC">"Accessing a Page Definition"</a>.</p> </li> <li> <p>Create an HTML region:</p> <ol> <li> <p>Under Regions, click the <span class="bold">Create</span> icon.</p> </li> <li> <p>Select the region type <span class="bold">HTML</span>.</p> </li> <li> <p>Follow the on-screen instructions.</p> </li> </ol> </li> <li> <p>Start adding items to the page:</p> <ul> <li> <p>Under Items, click the <span class="bold">Create</span> icon.</p> </li> <li> <p>Follow the on-screen instructions.</p> </li> </ul> </li> </ol> <div class="sect3"><!-- infolevel="all" infotype="General" --><a id="sthref1078" name="sthref1078"></a> <h2><a name="HTMDB25387" id="HTMDB25387"></a>Processing a <a id="sthref1079" name="sthref1079"></a>Form</h2> <p>Once you create a form, the next step is to process the data a user types by inserting into or updating the underlying database tables or views. There are three ways to process a form:</p> <ul> <li> <p><a href="#CEGCHJGJ">Creating an Automatic Row (DML) Processing Process</a></p> </li> <li> <p><a href="#CEGGJCAI">Creating a Process that Contains One or More Insert Statements</a></p> </li> <li> <p><a href="#CEGGEACE">Using a PL/SQL API to Process Form Values</a></p> </li> </ul> </div> <!-- class="sect3" --> <a id="CEGCHJGJ" name="CEGCHJGJ"></a> <div class="sect3"><!-- infolevel="all" infotype="General" --> <h2><a name="HTMDB25388" id="HTMDB25388"></a>Creating an Automatic Row (DML) Processing <a id="sthref1080" name="sthref1080"></a>Process</h2> <p>One common way to implement a form is to manually create an Automatic Row Processing (DML) process. This approach offers three advantages. First, you are not required to provide any SQL coding. Second, Oracle Application Express performs DML processing for you. Third, this process automatically performs lost update detection. Lost update detection ensures data integrity in applications where data can be accessed concurrently.</p> <p>To implement this approach you need to:</p> <ul> <li> <p>Add items, define the Item Source Type as Database Column, and specify a case-sensitive column name.</p> </li> <li> <p>Select the option <span class="bold">Always overrides the cache value</span>.</p> </li> </ul> <p>To create an Automatic Row Processing (DML) process:</p> <ol> <li> <p>Navigate to the appropriate Page Definition. See <a href="bldr_goto_pgdef.htm#CJGHCACC">"Accessing a Page Definition"</a></p> </li> <li> <p>Under Processes, click the <span class="bold">Create</span> icon.</p> </li> <li> <p>Select the process <span class="bold">Data Manipulation</span>.</p> </li> <li> <p>Select the process category <span class="bold">Automatic Row Processing (DML)</span>.</p> </li> <li> <p>Specify the following process attributes:</p> <ol> <li> <p>In the Name field, enter a name to identify the process.</p> </li> <li> <p>In the Sequence field, specify a sequence number.</p> </li> <li> <p>From the Point list, select the appropriate processing point. In most instances, select <span class="bold">Onload - After Header</span>.</p> </li> <li> <p>From the Type list, select <span class="bold">Automated Row Processing (DML)</span>.</p> </li> </ol> </li> <li> <p>Follow the on-screen instructions.</p> </li> </ol> </div> <!-- class="sect3" --> <a id="CEGGJCAI" name="CEGGJCAI"></a> <div class="sect3"><!-- infolevel="all" infotype="General" --> <h2><a name="HTMDB25389" id="HTMDB25389"></a>Creating a Process that Contains One or More Insert Statements</h2> <p>In this approach to form handling, you create one or more processes to handle insert, update, and delete actions. Instead of having the Application Express engine handling everything transparently, you are in complete control.</p> <p>For example, suppose you have a form with three items:</p> <ul> <li> <p><code>P1_ID</code> - A hidden item to store the primary key of the currently displayed row in a table.</p> </li> <li> <p><code>P1_FIRST_NAME</code> - A text field for user input.</p> </li> <li> <p><code>P1_LAST_NAME</code> - A text field for user input.</p> </li> </ul> <p>Assume also there are three buttons labeled Insert, Update, and Delete. Also assume you have a table T that contains the columns <code>id</code>, <code>first_name</code>, and <code>last_name</code>. The table has a trigger that automatically populates the <code>ID</code> column when there is no value supplied.</p> <p>To process the insertion of a new row, you create a conditional process of type PL/SQL that executes when the user clicks the Insert button. For example:</p> <pre xml:space="preserve" class="oac_no_warn"> BEGIN INSERT INTO T ( first_name, last_name ) VALUES (:P1_FIRST_NAME, :P1_LAST_NAME); END; </pre> <p>To process the updating of a row, you create another conditional process of type PL/SQL. For example:</p> <pre xml:space="preserve" class="oac_no_warn"> BEGIN UPDATE T SET first_name = :P1_FIRST_NAME, last_name = :P1_LAST_NAME WHERE ID = :P1_ID; END; </pre> <p>To process the deletion of a row, you create a conditional process that executes when the user clicks the Delete button. For example:</p> <pre xml:space="preserve" class="oac_no_warn"> BEGIN DELETE FROM T WHERE ID = :P1_ID; END; </pre></div> <!-- class="sect3" --> <a id="CEGGEACE" name="CEGGEACE"></a> <div class="sect3"><!-- infolevel="all" infotype="General" --> <h2><a name="HTMDB25390" id="HTMDB25390"></a>Using a PL/SQL API to Process Form Values</h2> <p>For certain types of applications, it is appropriate to centralize all access to tables in a single or a few PL/SQL packages. If you created a package to handle DML operations, you can call procedures and functions within this package from an After Submit PL/SQL process to process insert, updates, and delete requests.</p> </div> <!-- class="sect3" --> <div class="sect3"><!-- infolevel="all" infotype="General" --><a id="sthref1081" name="sthref1081"></a> <h2><a name="HTMDB25391" id="HTMDB25391"></a>Populating <a id="sthref1082" name="sthref1082"></a>Forms</h2> <p>Oracle Application Express populates a form either on load or when the Application Express engine renders the page. You can populate a form in the following ways:</p> <ul> <li> <p>Create a process and define the type as Automated Row Fetch.</p> </li> <li> <p>Populate the form manually by referencing a hidden session state item.</p> </li> </ul> <p>To create an Automated Row Fetch process:</p> <ol> <li> <p>Navigate to the appropriate Page Definition. See <a href="bldr_goto_pgdef.htm#CJGHCACC">"Accessing a Page Definition"</a>.</p> </li> <li> <p>Under Processes, click <span class="bold">Create</span>.</p> </li> <li> <p>Select the process type <span class="bold">Data Manipulation</span>.</p> </li> <li> <p>Select the process category <span class="bold">Automatic Row Fetch</span>.</p> </li> <li> <p>Specify the following process attributes:</p> <ol> <li> <p>In the Name field, enter a name to identify the process.</p> </li> <li> <p>In the Sequence field, specify a sequence number.</p> </li> <li> <p>From the Point list, select the appropriate processing point.</p> </li> <li> <p>From the Type list, select <span class="bold">Automated Row Fetch</span>.</p> </li> </ol> </li> <li> <p>Follow the on-screen instructions.</p> </li> </ol> <p>You can also populate a form manually by referencing a hidden session state item. For example, the following code in an Oracle Application Express process of type PL/SQL would set the values of <code>ename</code> and <code>sal</code>. The example also demonstrates how to manually populate a form by referencing a hidden session state item named <code>P2_ID</code>.</p> <pre xml:space="preserve" class="oac_no_warn"> FOR C1 in (SELECT ename, sal FROM emp WHERE ID=:P2_ID) LOOP :P2_ENAME := C1.ename; :P2_SAL := C1.sal; END LOOP; </pre> <p>In this example:</p> <ul> <li> <p><code>C1</code> is an implicit cursor.</p> </li> <li> <p>The value of <code>P2_ID</code> has been set.</p> </li> <li> <p>The process point for this process would be set to execute (or fire) on or before <span class="bold">Onload - Before Regions</span>.</p> </li> </ul> </div> <!-- class="sect3" --></div> <!-- class="sect2" --> <!-- Start Footer --> <div class="footer"> <table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%"> <col width="86%" /> <col width="*" /> <tr> <td align="left"><span class="copyrightlogo">Copyright © 2003, 2009, Oracle and/or its affiliates. All rights reserved.</span><br /> <a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td> <td align="center"><a href="bldapp_frm_detail.htm"><img src="dcommon/gifs/leftnav.gif" alt="Previous" /><br /> <span class="icon">Previous</span></a> </td> <td align="center"><a href="bldapp_frm_val.htm"><img src="dcommon/gifs/rightnav.gif" alt="Next" /><br /> <span class="icon">Next</span></a></td> </tr> </table> </div> <!-- class="footer" --> </body> </html>
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de