Websydian v6.1 online documentationOnline documentation - Websydian v6.5

Other Uses of the Document Template Generator

Specifying the Document Template Title

The base name (without the scope prefix) of the Page Generator function is used as the title of the generated Document Template.  If the Page Generator function has a FNC name NME triple, the defined name is used as the document title.

Sequence of Fields and Forms in Document Template

The sequence of the fields in the generated Details and Grid regions is determined by the sequence of the triples in the model editor.

If a Page Generator function inherits from an abstract Page Generator function with fields in the WsyDetails or WsyGrid variables, and if these variables contain views as well, it can be difficult to figure out the exact sequence of the individual fields.

The sequence of the fields in the Details and Grid regions will be the same as the sequence of the fields in the WsyDetails and WsyGrid variables in the variable editor.  The generated sequence of the fields in the Document Templates can safely be altered manually as a part of the HTML layout.

The sequence of the event forms on the HTML page is like this: First all events defined by a FNC includes FNC triple are generated in the same sequence as the triples in the model editor.  Then the events defined by FNC comprises FNC triples are generated, again in the same sequence as the triples in the model editor.  The sequence of the Event Handler forms can also safely be altered during the HTML layout process.

Omitting Fields from Generated Document Templates

Omitting fields in the WsyDetails and WsyGrid variables from being included in the generated Document Templates are specified at Page Generator level.  This is done by including the fields to be omitted in the OmitDetailsFields and OmitGridFields local variables of the Page Generator.

See also the Omitting Fields from Generated Document Templates section in the Other Uses of the Page Generator page

HTML Forms in the Document Template

For each Event Handler function associated to the Page Generator function, an HTML form is generated on the Document Template.  The HTML forms will either be details forms or grid forms depending on the setting of the WSYD Grid event option.  See also the Background page for a detailed overview of the generated Document Templates.

Generating Input Fields in HTML Form

For each field in the WebInput variable, an input field tag is constructed in the HTML form of the Event Handler function.  The value of the attributes depends on the type of the field.

<INPUT TYPE=field type  ...>

First, every field defined in the Hidden variable is added as hidden input tags in the form.  Secondly, all remaining fields in the WebInput variable are added as normal input tags to the form.  The type of each input tag is determined by the field control triple (FLD control SYS) as described by the table below:

FLD control SYS HTML tag
Text <INPUT TYPE=”TEXT” ...>
List, Combo <SELECT ...>
Radio <INPUT TYPE=”RADIO” ...>
Check <INPUT TYPE=”CHECK” ...>

For each INPUT or SELECT tag, the following HTML attributes are added during generation:

No Forms Generated for Event Handler Functions with Implement No

Event Handler functions associated to a Page Generator function - by includes or comprises triples - will not result in HTML forms on the generated HTML Document template if the functions are set to implement No.

Event Handlers Generated as Links

When the Generate submit button as link name option is set to Yes for an Event Handler, the specified Event Handler will be generated as an HTML Link reference in the Document Template instead of as a push button.  This option should only be specified when the Event Handler receives only hidden input.

Source Object Verb Target Object
AcmeEventHandler option NME
...value SYS
Generate submit button as link
Yes

Determine HTML Field Labels

Several candidates exist for the HTML field label that will appear in the generated HTML page.  Websydian determines the HTML field label in the following order of priority:

  1. Top label if defined
  2. Left label if defined
  3. Field name. If the field has a FLD name NME triple defined, the name object is used as the HTML field label.

If the HTML field label is determined to originate from one of the two possible field labels, the name will be chosen from one of the following items in order of priority:

  1. The large property of the label if defined
  2. The name triple of the label if defined
  3. The name of the label object

These rules apply to the generated field labels in the WsyDetails and the WsyGrid variables as well as to the field labels in the HTML forms.

Field Alignment

The field labels are aligned to the left and the field values are aligned according to the alignment triple of the fields.  If no alignment triple exists for a field, numeric fields are aligned to the right and other field types are aligned to the left.

Maximum Number of Field Columns in Grid Table

The maximum number of lines of text (i.e. field columns) between the two Grid markers in the Document Template is by default set to 128.  If this value is exceeded, an HTML Error Page will be called.

The maximum number of grid table columns is controlled by the Websydian StringArray variable:

Source Object Verb Target Object
ReplacementProcess variable VAR
...as SYS
...occurs NBR
StringArray
Local
128

The limit can be overridden in the individual Page Generator functions.

Reporting Error Messages during Document Template Generation

The Document Template Generator function has been extended to generate an error log file with the errors encountered during Template generation.  In this way, a number of common error situations are detected when running the Document Template Generator.  This is a very useful tool to catch errors during Websydian development.

The log file has the same name as the implementation name of the Document Template Generator function with a .LST extension.  Since this is the same extension that is used by the C++ compiler when it generates an error file, the Websydian error file can be viewed from the Generate and Build window of AllFusion Plex.  This is done by selecting View Source for the Template Generator function and then selecting the LST file.

If no errors are encountered during the generation of the Document Template, any existing LST file will be deleted in order to erase previous errors.

The following kind of errors are logged when running the Document Template Generator:

Missing Field Implementation Names

If a local field in WebInput, Hidden, WsyDetails or WsyGrid does not have an implementation name, an entry is created in the log file specifying the field that did not have an implementation name.  If the same field is used in more than one variable this will cause multiple entries in the error log.  Note that Websydian will still work because the field's surrogate name will be used instead, but typically you want to assign a meaningful implementation name to fields used in the Document Templates.

This check can be disabled with the Report missing field impl names option, e.g. when using fields from library models that do not have implementation names.

Missing Function File and Implementation Names

If the scoping Page Generator function does not have a file name or if any of the Event Handler functions do not have an implementation name this will be considered as errors.   This check can be disabled by using the Report missing fnc impl names option.

Hidden Field Not Specified in WebInput

If a local Event Handler field is specified in the Hidden variable, but not in the WebInput this is clearly an error.  The Hidden variable is used solely to specify which WebInput fields are hidden. This check cannot be disabled.

Hidden Field Not Specified in WsyDetails

Hidden Event Handler fields (specified in WebInput and Hidden variables) should also appear in either the WsyDetails variable or in the WsyGrid of the scoping Page Generator function depending on whether the Event Handler is a Grid event or not.  This situation will cause a signature error if the signature validation is enabled.  This check can not be disabled.

WebInput Variable as Input Variable

If the WebInput variable occurs as an Input variable in an Event Handler function, a warning will be generated in the error log.  This typically happens if one or more fields by mistake are entered as input fields for the WebInput variable instead of as local fields.  This check cannot be disabled.

Suppressing report of Error Messages during Document Template Generation

Using the function options "Report missing field impl names" and "Report missing fnc impl names" the developer is able to suppress generation of error messages during document template generation,

Source Object Verb Target Object
......_DocumentTemplateGenerator option NME
...value SYS
Report missing field impl names
No
option NME
...value SYS
Report missing fnc impl names
No

Omitting generation of Content Type information

By adding the option name "Generate start and end" to the DocumentTemplateGenerator the developer is able to suppress generation of the HEAD section in the document templates. This option is used by the ChildPageGenerator.
Source Object Verb Target Object
......_DocumentTemplateGenerator option NME
...value SYS
Generate start and end
No