This doc is correct for the 2014/01/08.

The decision tree is a fairly standard tree for running a wizard.
The inputs are split in to questions, with a decision on each input.
The same items are used for pure output entries.

Data items.

The basic list of attributes are modelled from HTML5; if you have some experience in web design, they are obvious.

  • 'type' ~ is the most important one, and entirely controls what happens to this item. Please see appendix.
  • 'value' ~ an initial value to be assigned to the input. Only used in the input side. For selects, this should be an array. If you supply a “hash”, the keys will be used as <option> text nodes, and the values the <option> value attribute (yes this is backwards, as duplicate list values are common, but duplicate list entries aren't).
  • 'name' ~ for inputs, the form inputs name attribute. Not generally manipulated, but please see recursion section. Must be unique across the installation, the internal routing uses these (and its good practice).
  • 'desc' ~ text displayed to a human, the label for an item. In the case of a 'p' or 'h2' item, the text node in those elements.
  • 'class' ~ the class attribute of a HTML element...
  • 'attribs' ~ anything you need adding to the result HTML, which isn't catered for. Add as a literal, no escaping will occur. This is a flat string.

Control flags.

  • 'next' ~ what item should be next. This is a two item array with a potential third item. The zeroth index states what is the next positive response question (and must be always supplied). The first index is for boolean question items, and states what is after a negative response. The third possible option is “positive” which records what happens for questions that aren't boolean, but need to be treated as such (select input normally).
  • 'attrib' ~ an array of control flags. Pls see the attrib appendix.
  • 'source' ~ for declarations, where to get the data from (as a question id, not a input name).
  • 'references' ~ for tables, what previous input items to pull from the session (and render as the table).
  • 'follows' ~ like an inversion of 'next'. Which items did you answer to get to this one? This is a list of item names, not question ids.

Recursive structures.

Used to output complex structures. A recursed call, loading another section of data (the type field is used as the name of the new section.). The recursed call may do anything that sections may do. The generated HTML is added at the current position, inside a wrapper div.

List of 'type'

  • 'text' ~ HTML standard.
  • 'radio' ~ HTML standard, the value needs be an array, with each option in it.
  • 'date' ~ HTML5 standard. Will emit a text input element, and JS will convert to a date input, when appropriate. If running in an older browser, will map a jquery datepicker instead.
  • 'select' ~ a standard HTML select.
  • 'textarea' ~ HTML standard.
  • 'email' ~ HTML5 standard input. Defaulting to behaving like text in older browsers. The JS validation will ensure a valid email regardless.
  • 'table' ~ will render a HTML table. Requires value to be an array of arrays.
  • 'p' ~ HTML standard.
  • 'h2' ~ HTML standard.
  • 'recurse*' ~ will recurse in the code. See recursive structures.

Although not a type, the NI-no and postcodes are validated with a proper regex.
The input validation is done via CSS classes, please read dynamism.js

List of 'attrib'

  • 'single' ~ used to make a row look like its part of the previous row (i.e. its single question).
  • 'store' ~ put an item into the declaration. Is in code base, but currently unused (the declaration is now dynamic).

Unused attribs to be removed :

  • 'terminal'
  • 'import'
  • 'wrap'
  • 'readonly'