Sunday, 14 June 2009

Tabular Forms - Autofill

Tabular Forms are used to manage master-detail dependencies. Usually for creating applications like:

- Order Management or
- Quote Management

For order or a quote management you would create a simple form to manage your header data. Tabular form would be used for order lines having hidden fileds for primary key and foreign key (order primary key). Order lines are usually items comming from an item master table. Sometimes, these line items are available through a select list and the most of the information you need in a tabular form is already available and could be filled automatically:

- item description
- price
- quantity (default 1)
- other item properties

In this example in my Demo Application you can see how that can be done.

Selecting a product from the list would use Ajax to get the related information from the item master table for the selected product_id.

An on demand process would generate an xml stream and send it back to the page.

<desc>this xml genericly sets multiple items</desc>
<item id="f32_2">JavaScript: The Definitive Guide</item>
<item id="f33_2">31.49</item>
<item id="f34_2">David Flanagan</item>
<item id="f35_2">1</item>

A piece of javascript code would loop through that xml string and assign the values returned to the specified items in the tabular form.

No comments: