Difference between revisions of "Form templates"

From TempusServa wiki
Jump to navigation Jump to search
old>Admin
(Created page with ' The structure of the tags in the HTML template are * {tablename} * {pageselector} * {default_start} ** {default_name} ** {default_value} ** {default_help} * {default_end} You m…')
 
m (16 revisions imported)
 
(15 intermediate revisions by one other user not shown)
Line 1: Line 1:
== Structure and syntax ==


The structure of the tags in the HTML template are
The structure of the tags in the HTML template are
* {header}
* {tablename}
* {tablename}
* {pageselector}
* {pageselector}
Line 8: Line 10:
** {default_help}
** {default_help}
* {default_end}
* {default_end}
* {defaultField}
* {footer}


You may also add additional tags for special fields:
You may also add additional tags for special fields:
Line 13: Line 17:
* "{" + [field systemname] + "_value}"
* "{" + [field systemname] + "_value}"
* "{" + [field systemname] + "_help}"
* "{" + [field systemname] + "_help}"
== Template handling ==
Templates are injected with values from the current record like this
# For each field
## Try to inject [system fieldname] + [prefix]
## If failed
##* Copy content from {default_start} to {default_end}
##* Inject values into content copy
##* Inject content copy into {defaultField}
# Inject the form page selector into {pageselector}
## If failed: Ignore
Missing values for default_XXX tags wil automatically get appended to the template.
== Relation til styling ==
{|
!type
!class
!id
!content
!template
|-
|tbody
|PAGE_[field PageID]
|
|Container for a single field
|{default_start} / {default_end}
|-
|div
|FieldLabel
|NB_[system fieldname]
|Label for field
|{default_name}
|-
|div
|FieldValue
|VB_[system fieldname]
|Value of field / Input for field
|{default_value}
|-
|div
|FieldNotes
|HB_[system fieldname]
|Optional help text for the field
|{default_help}
|-
|}
== Example ==
  {header}<br/><br/>&lt;h3&gt;{tablename}&lt;/h3&gt;<br/><br/>&lt;table  class='tableForm'&gt;<br/> &lt;tr&gt;&lt;td style=&quot;padding: 0px; border: 0px;&quot;&gt;{pageselector}&lt;/td&gt;&lt;/tr&gt;<br/> {default_start}<br/> &lt;tr&gt;<br/> &lt;td class=&quot;tableFieldTableLabel&quot;&gt;&lt;p&gt;{default_name}&lt;/p&gt;&lt;/td&gt;<br/> &lt;/tr&gt;<br/> &lt;tr&gt;<br/> &lt;td class=&quot;tableFieldTableValue&quot;&gt;<br/> &lt;p&gt;{default_value}&lt;/p&gt;<br/> &lt;p&gt;{default_help}&lt;/p&gt;<br/> &lt;/td&gt;<br/> &lt;/tr&gt;<br/> {default_end}<br/> {defaultField}<br/>&lt;/table&gt;<br/><br/>{footer}

Latest revision as of 12:52, 10 December 2021

Structure and syntax

The structure of the tags in the HTML template are

  • {header}
  • {tablename}
  • {pageselector}
  • {default_start}
    • {default_name}
    • {default_value}
    • {default_help}
  • {default_end}
  • {defaultField}
  • {footer}

You may also add additional tags for special fields:

  • "{" + [field systemname] + "_name}"
  • "{" + [field systemname] + "_value}"
  • "{" + [field systemname] + "_help}"

Template handling

Templates are injected with values from the current record like this

  1. For each field
    1. Try to inject [system fieldname] + [prefix]
    2. If failed
      • Copy content from {default_start} to {default_end}
      • Inject values into content copy
      • Inject content copy into {defaultField}
  2. Inject the form page selector into {pageselector}
    1. If failed: Ignore

Missing values for default_XXX tags wil automatically get appended to the template.

Relation til styling

type class id content template
tbody PAGE_[field PageID] Container for a single field {default_start} / {default_end}
div FieldLabel NB_[system fieldname] Label for field {default_name}
div FieldValue VB_[system fieldname] Value of field / Input for field {default_value}
div FieldNotes HB_[system fieldname] Optional help text for the field {default_help}

Example

 {header}

<h3>{tablename}</h3>

<table class='tableForm'>
<tr><td style="padding: 0px; border: 0px;">{pageselector}</td></tr>
{default_start}
<tr>
<td class="tableFieldTableLabel"><p>{default_name}</p></td>
</tr>
<tr>
<td class="tableFieldTableValue">
<p>{default_value}</p>
<p>{default_help}</p>
</td>
</tr>
{default_end}
{defaultField}
</table>

{footer}