New Panther Web ‘at’ Variables for HTML Emitter’s Metadata and Extended Template Syntax Support within Panther Web Property Values

 

Four new 'at' variables are provided for referencing the name, field number, object id, or occurrence number of the widget currently being emitted.

 

The four new 'at' variables in Panther Web are:

 

  @web_emitting_name

  @web_emitting_fldnum

  @web_emitting_objid

  @web_emitting_occur

 

These new built-in variables will be empty when the Jserver is not in the process of emitting a widget. Even when emitting a widget, those that are not applicable will be empty.  For example, while emitting prefix markup for a grid frame, @web_emitting_name will contain the name of the grid frame widget and @web_emitting_objid will contain an object id for it.  However, @web_emitting_fldnum and @web_emitting_occur will both be empty since a grid frame widget has no field number or occurrence number.  On the other hand, while emitting a Single Line Text widget contained within that grid frame, both of these variables will contain values, and the other two will be correct for the Single Line Text widget rather than for the grid frame itself.

Extended Template Syntax Support within Property Values

There has always been the capability to add simple template tags to the values for the prefix_markup, suffix_markup, javascript, and vbscript properties of a widget.  Those properties have supported the {{value:}} tag using the form of it that does not explicitly use the keyword, 'value', such as {{myfieldname}}.  This has always allowed the capability to embed the values of fields or their property values within the emitted text for these properties.  The new built-in variables add versatility to this feature.  They help with several issues concerning widget and occurrence specific changes to the HTML emitted by the Jserver.  One may now assign specific classes or attributes to an element emitted for a selected occurrence of an array.

 

For example, the new feature allows you to use JPL like this:

 

dlbl->prefix_markup="<button onclick='onclick(category-{{@web_emitting_occur}})' type='button' class='btn btn-outline-success btn-sm'>-</button>"

 

However, the new feature goes a bit further.  Other template tags may now also be used within the value for the 'attributes' property, and all applicable template tag syntax is now supported.

 

For example, a prefix_markup property may now contain a value like this:

 

<div class='cl-{{if: (:@web_emitting_name)[@web_emitting_occur] == "x"}}special{{else:}}{{@web_emitting_occur}}{{end:}}'>

 

Note the complexity of the template tags shown above, which make use of the conditional evaluation of an expression that even contains colon preprocessing.

 

If the occurrence being emitted contains the value, 'x', this results in the following HTML output:

 

<div class='cl-special'>

 

Otherwise, for occurrences not containing an 'x' the Jserver will emit the following for occurrence 1:

 

<div class='cl-1'>

 

Or, for occurrence 2, it will emit this:

 

<div class='cl-2'>

 

Etc.       

 

Note that one cannot assign different web property values to different occurrences in server-side application code.  This new feature does not change that.  It simply allows for a client-side solution to such issues.