Edit D:\app\Administrator\product\11.2.0\dbhome_1\apex\images\doc\bldr_validate.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>Understanding Validations</title> <meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1" /> <meta name="date" content="2009-04-14T16:11:27Z" /> <meta name="robots" content="noarchive" /> <meta name="doctitle" content="Understanding Validations" /> <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="bldr_pgs.htm" title="Working with Application Pages" type="text/html" /> <link rel="up" href="bldr_pg_edit.htm" title="Editing a Page Definition" type="text/html" /> <link rel="up" href="bldr_validate.htm" title="Understanding Validations" type="text/html" /> <link rel="prev" href="bldr_pg_comp.htm" title="Previous" type="text/html" /> <link rel="next" href="bldr_pg_procs_about.htm" title="Next" type="text/html" /> </head> <body> <p id="BREADCRUMBING"><a href="preface.htm" title="Home">Home</a> > <a href="bldr_pgs.htm" title="Working with Application Pages">Working with Application Pages</a> > <a href="bldr_pg_edit.htm" title="Editing a Page Definition">Editing a Page Definition</a> > Understanding Validations</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="bldr_pg_comp.htm"><img src="dcommon/gifs/leftnav.gif" alt="Previous" /><br /> <span class="icon">Previous</span></a> </td> <td align="center"><a href="bldr_pg_procs_about.htm"><img src="dcommon/gifs/rightnav.gif" alt="Next" /><br /> <span class="icon">Next</span></a></td> </tr> </table> <p><a id="CHDEBBCE" name="CHDEBBCE"></a></p> <div class="sect2"><!-- infolevel="all" infotype="General" --> <h1><a name="HTMDB04018|validations"></a>Understanding <a id="sthref580" name="sthref580"></a>Validations</h1> <p>You can define a validation declaratively by selecting a validation method. You enter the actual validation edit check in the Validation Messages field. Be aware that if a validation fails, subsequent page processes or computations will not occur. Also remember that the validation you enter must be consistent with the validation type you selected. For more information about validation types, see online Help.</p> <a id="sthref581" name="sthref581"></a> <p class="subhead2">Topics:</p> <ul> <li> <p><a href="#CHDCBHHI">Creating a Validation</a></p> </li> <li> <p><a href="#CHDIIDHE">Defining How Validation Error Messages Display</a></p> </li> <li> <p><a href="#CHDBGIAD">Processing Validations Conditionally</a></p> </li> </ul> <div align="center"> <div class="inftblnotealso"><br /> <table class="NoteAlso oac_no_warn" summary="" cellpadding="3" cellspacing="0"> <tbody> <tr> <td align="left"> <p class="notep1">See Also:</p> <a href="concept_sub_strings.htm#CHDDCFIJ">"About the When Button Pressed Attribute"</a></td> </tr> </tbody> </table> <br /></div> <!-- class="inftblnotealso" --></div> <a id="CHDCBHHI" name="CHDCBHHI"></a> <div class="sect3"><!-- infolevel="all" infotype="General" --> <h2><a name="HTMDB25141" id="HTMDB25141"></a>Creating a Validation</h2> <p>To create a validation:</p> <div align="center"> <div class="inftblnote"><br /> <table class="Note oac_no_warn" summary="" cellpadding="3" cellspacing="0"> <tbody> <tr> <td align="left"> <p class="notep1">Note:</p> Text entered for validations may not exceed 3,950 characters.</td> </tr> </tbody> </table> <br /></div> <!-- class="inftblnote" --></div> <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 Validations in Page Processing, click the <span class="bold">Create</span> icon.</p> <p>The <a id="sthref582" name="sthref582"></a><a id="sthref583" name="sthref583"></a>Create Validation Wizard appears.</p> </li> <li> <p>Select a validation level:</p> <ul> <li> <p><span class="bold">Item level validations</span> are specific to a single item.</p> </li> <li> <p><span class="bold">Page level validations</span> do not apply to any single item, but apply to an entire page.</p> </li> </ul> </li> <li> <p>If you selected <span class="bold">Item level validation</span>, select the item to be validated and click <span class="bold">Next</span>.</p> </li> <li> <p>Select a validation method as described in <a href="#BABFGHAD">Table: Validation Methods</a>.</p> <div class="tblformal"><a id="sthref584" name="sthref584"></a><a id="BABFGHAD" name="BABFGHAD"></a> <p class="titleintable">Validation Methods</p> <table class="Formal" title="Validation Methods" summary="The table describes the validation methods you can select when creating a new validation." dir="ltr" border="1" width="100%" frame="hsides" rules="groups" cellpadding="3" cellspacing="0"> <col width="24%" /> <col width="*" /> <thead> <tr align="left" valign="top"> <th align="left" valign="bottom" id="r1c1-t45">Validation Method</th> <th align="left" valign="bottom" id="r1c2-t45">Descriptions</th> </tr> </thead> <tbody> <tr align="left" valign="top"> <td align="left" id="r2c1-t45" headers="r1c1-t45"> <p>SQL</p> </td> <td align="left" headers="r2c1-t45 r1c2-t45"> <p>Compares item values to data in the database.</p> <p>For example, you can use a SQL validation to verify whether a last name typed into a field exists in the database. In the following Exists SQL validation, the field is named <code>P1_LAST_NAME</code> and the table is named <code>customers</code>.</p> <pre xml:space="preserve" class="oac_no_warn"> SELECT 1 FROM customers WHERE last_name = :P1_LAST_NAME </pre></td> </tr> <tr align="left" valign="top"> <td align="left" id="r3c1-t45" headers="r1c1-t45"> <p>PL/SQL</p> </td> <td align="left" headers="r3c1-t45 r1c2-t45"> <p>Useful if you need complex logic to validate entered data.</p> <p>For example, suppose you need to create a validation for an address form that requires the user to enter a province if the address is not in the United States. You could create the validation as a Function Returning Boolean, using the following PL/SQL:</p> <pre xml:space="preserve" class="oac_no_warn"> BEGIN IF :P1_COUNTRY = 'US' AND :P1_PROVINCE IS NULL THEN RETURN FALSE; ELSE RETURN TRUE; END IF; END; </pre> <p>You could also create the same validation implemented as a PL/SQL Expression as follows:</p> <pre xml:space="preserve" class="oac_no_warn"> NOT (:P1_COUNTRY='US' AND :P1_PROVINCE IS NULL); </pre></td> </tr> <tr align="left" valign="top"> <td align="left" id="r4c1-t45" headers="r1c1-t45"> <p>Item Level Null</p> </td> <td align="left" headers="r4c1-t45 r1c2-t45"> <p>Checks if an item's value in session state is null.</p> <p>For example, you could validate that the user enters a value in a field by creating an item validation and then selecting the validation method <span class="bold">Item Not Null</span>.</p> </td> </tr> <tr align="left" valign="top"> <td align="left" id="r5c1-t45" headers="r1c1-t45"> <p>Item String Comparison</p> </td> <td align="left" headers="r5c1-t45 r1c2-t45"> <p>Compares the value of an item to a specific string.</p> <p>There are several string comparison validations that compare the value of an item to a literal string. For example, you select the validation type <span class="bold">Item in Expression 1 is contained in Expression 2</span> to validate a user entry in a field against a list of values you provide.</p> <p>In Expression 1, enter the name of the item you want to validate without a colon. For example:</p> <pre xml:space="preserve" class="oac_no_warn"> P1_VALUE </pre> <p>In Expression 2, enter a string of values you want to validate against. For example:</p> <pre xml:space="preserve" class="oac_no_warn"> ABC/DEF/GHI </pre></td> </tr> <tr align="left" valign="top"> <td align="left" id="r6c1-t45" headers="r1c1-t45"> <p>Regular Expression</p> </td> <td align="left" headers="r6c1-t45 r1c2-t45"> <p>Regular expressions provide a method to describe text patterns. Use a Regular Expression validation to perform data validation.</p> <p>For example, you could use the following regular expression validation to verify that a string of entered data always consists of groups of six numbers separated by commas and followed by a comma:</p> <pre xml:space="preserve" class="oac_no_warn"> ^([[:digit:]]{6},)+$ </pre> <p>This regular expression would find the following entries valid:</p> <p><code>123456,654321,</code></p> <p><code>123456,</code></p> <p><code>123456,123456,654321</code>,</p> <p>However, the following would not be valid:</p> <p><code>123456,12345</code></p> <p><code>12345</code></p> </td> </tr> </tbody> </table> <br /></div> <!-- class="tblformal" --></li> <li> <p>For SQL, PL/SQL, and Item String Comparison validations, select the type of validation you want to create and click <span class="bold">Next</span>.</p> </li> <li> <p>Specify the sequence and validation name and click <span class="bold">Next</span>.</p> </li> <li> <p>Depending upon the validation method, enter the validation or message text that displays if the validation fails. Click <span class="bold">Next</span>.</p> </li> <li> <p>Define conditions that apply to this validation and click <span class="bold">Create</span>.</p> </li> </ol> <div align="center"> <div class="inftblnotealso"><br /> <table class="NoteAlso oac_no_warn" summary="" cellpadding="3" cellspacing="0"> <tbody> <tr> <td align="left"> <p class="notep1">See Also:</p> <a href="bldapp_frm_val.htm#CHDBGEGA">"Validating User Input in Forms"</a></td> </tr> </tbody> </table> <br /></div> <!-- class="inftblnotealso" --></div> </div> <!-- class="sect3" --> <a id="CHDIIDHE" name="CHDIIDHE"></a> <div class="sect3"><!-- infolevel="all" infotype="General" --> <h2><a name="HTMDB25142" id="HTMDB25142"></a>Defining How Validation Error Messages Display<a id="sthref585" name="sthref585"></a></h2> <p>You can choose to have validation error messages display inline (that is, on the page where the validation is performed) or on a separate error page.</p> <p>To define how a validation error message displays:</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 Validations, select the appropriate validation.</p> <p>The attributes page for the validation appears.</p> </li> <li> <p>Scroll down to Error Message.</p> </li> <li> <p>In Error Message, enter your error message text.</p> </li> <li> <p>From Error message display location, select a display location.</p> <p>This attribute identifies where a validation error message displays. <span class="bold">Validation error messages</span> can display on an error page or inline within the existing page. <span class="bold">Inline error messages</span> can display in a notification area (defined as part of the page template) or within the field label.</p> <p>To create a hard error that stops all processing (including validations), you must display the error on an error page.</p> </li> <li> <p>If you select Inline with Field or Inline with Field and in Notification, you must associate an item with the error message. To associate an item with the error message, select the item from the Associated Item list.</p> </li> <li> <p>Click <span class="bold">Apply Changes</span>.</p> </li> </ol> <div align="center"> <div class="inftblnotealso"><br /> <table class="NoteAlso oac_no_warn" summary="" cellpadding="3" cellspacing="0"> <tbody> <tr> <td align="left"> <p class="notep1">Tip:</p> If you select <span class="bold">Inline with Field</span> or <span class="bold">Inline with Field and in Notification</span>, be aware that the Application Express engine does not execute computations or processes during the re-rendering of the page when the validation error messages appear.</td> </tr> </tbody> </table> <br /></div> <!-- class="inftblnotealso" --></div> </div> <!-- class="sect3" --> <a id="CHDBGIAD" name="CHDBGIAD"></a> <div class="sect3"><!-- infolevel="all" infotype="General" --> <h2><a name="HTMDB25143" id="HTMDB25143"></a>Processing Validations Conditionally<a id="sthref586" name="sthref586"></a></h2> <p>You can control when and if a validation is performed under Conditions.</p> <p>To create a condition for an existing validation:</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 Validations, select the appropriate validation.</p> <p>The attributes page for the validation appears.</p> </li> <li> <p>Scroll down to Conditions.</p> </li> <li> <p>To have a validation performed when a user clicks a particular button, make a selection from the When Button Pressed list.</p> </li> <li> <p>Make a selection from the Condition Type list.</p> </li> <li> <p>Depending upon the selected Condition Type, enter values in the Expression attributes. The validation will be rendered or processed if the specified condition is met.</p> </li> <li> <p>Click <span class="bold">Apply Changes</span>.</p> </li> </ol> </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="bldr_pg_comp.htm"><img src="dcommon/gifs/leftnav.gif" alt="Previous" /><br /> <span class="icon">Previous</span></a> </td> <td align="center"><a href="bldr_pg_procs_about.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