« Testing HBlogger | Main | Tire Size Calculator »
September 02, 2005
HTMLDB Tabular Form Validation
Q: I have created a master/detail form and a tabular form by using the wizard. How can I add validations? Is it possible to reference the different values?
A: Response by Indrek Sooneste at HTMLDB forum
There are some tricks that can be used to validate detail form. At first take a look to your detail form, it is just a report. And updates are made using values in HTMLDB_APPLICATION.G_Fxx (where xx some number start at 01).
Example:
I made a master/detail form on demo_order and demo_order_items tables.
The select behind in detail form is
select "ORDER_ITEM_ID", "ORDER_ID", "PRODUCT_ID", "UNIT_PRICE", "QUANTITY" from "#OWNER#"."DEMO_ORDER_ITEMS" where "ORDER_ID" = :P5_ORDER_ID
So I created page level validation that checks if unit_price is empty and returns error message.
begin FOR i IN 1.. HTMLDB_APPLICATION.G_F05.COUNT LOOP if HTMLDB_APPLICATION.G_F05(i) is null then return 'Unit Price cann''t be empti'; end if; END LOOP; return null; end;
To figure out what is the right number for G_Fxx check the HTML source. The error message is displayed inline in notification.
When you want to show error message inline with filed then you have to rebuild your detail form and use collections.
Posted by rimblas at September 2, 2005 07:29 AM