Skip to end of metadata
Go to start of metadata

DB Storage of Form Elements
----------------------------
Issues (lobo)
-------------

  • Planning for user-level customizations - vs. global customizations stored in DB
  • Store 'option values/labels' in separate table, or as lists?
  • Flexinode enums fieldTypes based on directory scan of mods which define each type. Is this a good model?
  • Should we separate validation function/rule from required? boolean. Should all validation functions live in separate modules
    and be enum'd by directory scan as well.

Features Desired
----------------

  • Support all HTML control-types + custom types (jScript selector, two-select box chooser...???)
  • Set field size, set row and cols for textarea
  • Pass additional attribs (e.g. "onSelect= ", "MULTIPLE", etc.)
  • Set default values for any field type
  • Set option labels AND option values separately
  • Set NULL option value/label
  • Set/change sort order for options
  • Define 'core/locked' AND 'extension/dynamic' form elements
  • Include data type and validation 'function' name. Separate required? from validation rule??
  • Support form_groups with legends, visibility rules (default visibility state, and may-be-hidden)
  • Flag fields/groups which are 'clonable'
  • Ability to add form, form_group, and form_element level "help/hints"

Proposed Table Struct
----------------------

Flexinode Model
---------------
Flexinode forms are 'content types', each one containing 1->n form_elements.
flexinode_type table contains a row for each, sets ctype_id (PK) + name, description, and helpText
? What other info would be useful here if used for 'sets' of dynamic fields ?

  • weight (if we were loading +1 sets of form_elements on a single page, or to order dynamic sets)
  • standalone (vs. included on 'standard' page) ?
    flexinode_field defines each form element, includes label + description + field_type + options
  • field_type enum populated via directory scan of field_*.inc files (can extend by creating new .inc files)
  • show_table is nice feature, allows include/exclude from tabular view

Flexinode Table Defs
-----------------------
CREATE TABLE flexinode_type (
ctype_id int(10) unsigned NOT NULL default '0',
name varchar(255) NOT NULL default '',
description varchar(255) NOT NULL default '',
help text NOT NULL default '',
PRIMARY KEY ctype_id (ctype_id)
) TYPE=MyISAM;

CREATE TABLE flexinode_field (
field_id int(10) unsigned NOT NULL default '0',
ctype_id int(10) unsigned NOT NULL default '0',
label varchar(255) NOT NULL default '',
default_value mediumtext NOT NULL default '',
weight int(10) NOT NULL default '0',
required int(1) NOT NULL default '0',
show_teaser int(1) NOT NULL default '0',
show_table int(1) NOT NULL default '0',
rows int(10) unsigned NOT NULL default '0', //rows = height for textarea fields
field_type varchar(255) NOT NULL default '', //
options text NOT NULL default '',
description varchar(255) NOT NULL default '',
PRIMARY KEY field_id (field_id),
KEY ctype_id (ctype_id)
) TYPE=MyISAM;

CREATE TABLE flexinode_data (
nid int(10) unsigned NOT NULL default '0',
field_id int(10) unsigned NOT NULL default '0',
textual_data mediumtext NOT NULL default '',
numeric_data int(10) unsigned NOT NULL default '0',
serialized_data mediumtext NOT NULL default '',
PRIMARY KEY id (nid,field_id)
) TYPE=MyISAM;

Labels:

Creative Commons License
Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-Share Alike 3.0 United States Licence.