HomeOracle Adding Computations, Processes, and Validations
Adding Computations, Processes, and Validations
Validations, computations, and processes greatly increase the functionality of an HTML DB application. In this three-part series (of which this is the first part), you'll learn about the different types and where to use them. This article is excerpted from chapter 13 of the Oracle HTML DB Handbook, written by Lawrence Linnemeyer and Bradley Brown (McGraw-Hill, 2006; ISBN: 0072257687).
Validations, computations, and processes are the mechanism by which the developer implements business logic. We have seen processes that have been created for us by the multitude of wizards within HTML DB—some to populate fields, some to process changes to a record, others to process multiple records.
Recall from Chapter 8 the method by which a page is rendered and then processed after it is submitted. Two main HTML DB engine processes are used for these two tasks: Show Page (rendering) and Accept Page (processing). Computations and processes can be used both in the rendering of a page and in the processing of a page. Validations are only used after a page has been submitted as a means to validate the data the user has submitted for processing.
In this chapter, we will look at validations, computations, and processes and how they greatly increase the functionality of an HTML DB application. We will explore the different types and when and where to use them. These three things allow you to bring together everything else we have covered to this point.
Validations are the method HTML DB provides to the developer to ensure the quality of data entered by a user prior to the data being submitted for processing. This is an important point to remember: if any part of your validation fails, no further processing will occur. This is not to say that the remainder of the validation will not occur, just that the processing will not occur.
Validations can be either item validations or page validations. Item validations are associated with a specific item on the page and check something specific about that item’s value, such as if the item is null or if the item is greater than a certain value. Page validations are not associated with a specific item and may check a business rule that concerns several items on the page.
When a validation fails, the user is either returned to the page that was submitted or sent to an error page. One very good reason not to use the error page is that as soon as the validation process hits one failed validation, the user will navigate to the error page and see that single error message. Therefore, if they have several problems, they will make several trips to the error page. If you choose to display your error messages back on the submitted page, all the validations will occur and the user can see all the errors they must correct at the same time. The validation error messages, which are displayed back on the submitted page, can either be displayed in the submitted page’s #NOTIFICATION_MESSAGE# section or presented next to the items with which they are associated, or both.