Online documentation - Websydian v6.0 |
Users Guide | Patterns Reference | WebsydianExpress | Search |
Implementing Parts
The PageGeneratorWithErrorList pattern is used by Page Generator functions containing forms where users can enter data. In case of failed validation, the Page Generator can be called again to generate the original HTML page merged with the Error Messages from the failed validation.
If a Page Generator function inherits from the PageGeneratorWithErrorList pattern, the Page Generator will work as an 'extended Error Page' function. By calling the Page Generator itself in case of failed validation, the Page Generator will generate the error message(s) merged with the original page on which the erroneous data were entered. The input values from the failed request are preserved and in this way, the user will be able to correct the error(s) and resubmit the request.
Defining Page Generators with error lists is straight-forward, as described by the example below:
The Page Generator must inherit from the PageGeneratorWithErrorList pattern and the Event Handlers doing the validation should have their references to the ErrorPage function replaced by the Page Generator itself.
Example:
MyProductInsertPage | is a FNC | PageGeneratorWithErrorList |
MyProductInsertPage.Insert | replaces FNC ...by FNC |
ErrorPage MyProductInsertPage |
The PageGeneratorWithErrorList pattern adds an ErrorMode field to the Page Generator function. The value of this field determines whether to generate the HTML page in Error mode or in Normal mode.
In all calls from Event Handlers to a Page Generator with Error list, the actual parameter for the ErrorMode field must be mapped to either *Yes (in Error mode) or No* (in Normal mode). In some situations, this value mapping must be done in inherited call-statements.
Generate and build the modified Page Generator and Event Handlers, and run the Document Template Generator of the Page Generator.
Do also make sure that the HtmlChildErrorPage function has been generated and built, and that the Document Template Generator of the Child Error Page has been executed.
By default, a /(WSYDERR) Page Replacement Marker is inserted into the top of the generated Document Template. The Page Replacement Marker indicates where in the generated page, the Error List will be inserted. It may be considered to move the Page Replacement Marker to elsewhere in the Document Template.
Example of a generated HTML page containing an Error Message List.