Online documentation - Websydian v6.1 |
Implementing Other Uses Parts
In the Implementing page, it is explained how to use the MultipleInputGrid pattern to implement a standard database update of a number of Grid records. The MultipleInputGrid pattern may also be used in other situations as outlined below.
In order to have normal Grid Event Handlers in a Grid that also contains a multi-input Event Handler, the Grid Event FORM construct must be moved out of the Grid region in the HTML page. The entire grid is already enclosed in a FORM construct, and HTML does not allow forms inside other forms. When the event (push button or link) is triggered, a call must be specified to a JavaScript function which activates the form and transfers the actual event parameters.
The MultipleInputGrid pattern may also be used for insertion of multiple rows.
In this situation, inheritance from the WebGridPage pattern is not needed. The user input fields must still be defined as local fields for the MultipleWebInput variable of the ProcessGrid Event Handler function, and at least one non-omitted field needs to be specified in the WsyGrid variable of the Page Generator function (or the Grid-portion will not be included in the generated Document Template).
Example:
Specify Page Generator and Event Handler triples:
InsertMultipleProducts | is a FNC | MultipleInputGrid |
local FLD ...for VAR |
SomeField WsyGrid |
|
file name | InsProd | |
impl name | InsProd |
InsertMultipleProducts.ProcessGrid | local view VW ...for VAR |
Product.Update MultipleWebInput |
MyDispatcher | calls FNC | ProcessGrid |
The action diagram code below will implement the insertion of up to 10 records:
The ProcessGrid Event Handler function only inserts records entered by the user.
Do also insert a call to the next Page Generator function to be called.