Table of Contents

Article

Guidance for hand-crafted HTML code in sections and flow action rules

Summary

This article summarizes best practice recommendations regarding the development of section rules and flow action rules, and restrictions on the HTML code you can enter when creating a hand-crafted section rule or flow action rule.  



 

Suggested Approach

Auto Generated

The preferred approach for section rules (Rule-HTML-Section rule type) and flow actions (Rule-Obj-FlowAction) is to use auto-generated HTML and create the display interactively using the Layout tab (or Format tab).

When the Auto-Generate HTML? check box on the HTML tab is selected, Process Commander generates HTML code each time you save a Section form or Flow Action form.

This approach generates correct HTML code, conforms to the guardrails and poses the least risk.

Non Auto-Generated

For special situations involving customized displays, it may be necessary to clear this check box and enter custom HTML code.  This should be used sparingly and with great care. 

The best practice is to create as much of the HTML infrastructure with auto- generated sections and flow actions and use hand-crafted HTML code in small custom spots.  When a non-auto generated section is needed, follow the guidelines below to allow the browser to correctly render the HTML and to allow the Harness, Section, and Flow Action forms to correctly incorporate these hand-crafted section

Complete HTML Element Structure

When creating small HTML snippets, do not code incomplete HTML structures.   This makes it hard for the browser to correctly render these in different contexts and may cause the rule form to show script errors and/or cause an unrecoverable error.

For example, don't include <TD> tags without corresponding <TABLE> and <TR> tags.  Although <TD> tags without a <TABLE> tag are acceptable in the HTML code for a HTML rule (Rule-Obj-HTML), when <TD> tags are used separately in a section rule they are likely to cause problems.  Most places in the Layout tab (or Format tab) where you are allowed to drop sections are in fact a <TD> </TD> pair.  The HTML definition does not allow a <TD> tag inside a <TD> tag..

The following structures should be complete:

<TABLE> (with corresponding TBODY, THEAD, TR, TH, TD)

<FIELDSET> (with corresponding LEGEND)

<OL>,<UL> (with corresponding LI)

Illegal HTML Tags

The following HTML tags should not appear in a hand-crafted section rule. Remember that a section is part of a larger form, not a complete HTML document itself. 

  • <HTML>

    The <HTML >tag cannot appear within the scope of another <HTML> tag. The <HTML> tag is part of the harness rule.

  • <body >

    Similarly, an HTML document can have only one <body> tag. The <body> tag is part of the harness rule

  • <Head>

    All sections reside inside the <body> tag of a harness rule.

  • <Link>

    According to the definition, <link> tags can only be inside of a <head>.  Because the <head> tag is part of the harness, you can not include your own <link> tag.

Reference HTML

All the above restrictions also apply to Referenced HTML in a flow action or an include directive for HTML rules or or HTML fragments.

Use caution when including Rule-Obj-HTML and Rule-HTML-Fragment rule so that they don't violate any of these restrictions.  You cannot, for example include a Rule-Obj-HTML rule that is itself a complete HTML document, or a single <TR> or <TD> and so on.

Tags:

Published September 7, 2005 — Updated November 15, 2015


42% found this useful

Have a question? Get answers now.

Visit the Pega Support Community to ask questions, engage in discussions, and help others.