Reference Field: Difference between revisions

From IHRIS Wiki
Line 5: Line 5:


==Magic Data Structure==
==Magic Data Structure==
*forms: required parent node.  subnodes are scalar nodes whose values are the forms that this field can reference.
*form: required parent node.  subnodes are scalar nodes whose values are the forms that this field can reference.
*meta: required parent node.
*meta: required parent node.
**display: required parent node.  names of sub-nodes are the names of the forms that this field can reference.   
**display: required parent node.  names of sub-nodes are the names of the forms that this field can reference.   

Revision as of 13:02, 11 February 2011

This describe the magic data structure used for defining a REFERENCE field. These options all live under

/modules/forms/formClasses/$formClass/fields/$field

for the given form class $formClass and field name $field.


Magic Data Structure

  • form: required parent node. subnodes are scalar nodes whose values are the forms that this field can reference.
  • meta: required parent node.
    • display: required parent node. names of sub-nodes are the names of the forms that this field can reference.
      • $refForm: required parent node. The name of the node, $refForm, is a form that this field can reference.
        • default: required parent node. The default display for the referenced form
          • printf: required (translatable) scalar node. A string which will get passed to printf to display the node. Example is "%s %s" which contains two substitutions
          • printf_args: required parent node: Sub-nodes should be ordered integers. requires 0..n sub-nodes if the printf contains (n+1) substutions.
            • 0: required scalar node the name of the first field whose display value is passed to printf
            • 1: requried scalar node the name of the next field whose display value is passed to printf
            • ...
            • n: requried scalar node the name of the last field whose display value is passed to printf
        • $display: optional parent node. Another named display for this field. Sub-nodes are exactly the same as those defined for default

HTML Template

To display the default <source lang='xml'>

  

</source>

To select another display, $display: <source lang='xml'>

  

</source>

Editing the Field Value

For the moment, the field is not editable. Rather its value should be set by a page's logic.

At a later point, we can make the value set via the selection of a primary form (or other?) in from a report.