Ferreteria/v2/usage/forms: Difference between revisions

From Woozle Writes Code
< Ferreteria‎ | v2‎ | usage
Jump to navigation Jump to search
(some v2 documentation)
m (23 revisions imported: moving this project here)
 
(13 intermediate revisions by one other user not shown)
Line 1: Line 1:
==About==
==About==
''This page may be slightly out of date, e.g. class names may have changed.''
'''Forms''' in Ferreteria consist of several sets of classes that work together:
'''Forms''' in Ferreteria consist of several sets of classes that work together:
* '''control''' classes render editable (and eventually non-editable) data fields
* '''control''' classes render editable (and eventually non-editable) data fields
* '''field''' classes handle translating values between internal storage and on-disk storage (database)
* '''field''' classes handle translating values between internal storage and on-disk storage (database)
 
==Status==
The Forms classes are being rewritten from scratch; this page applies to the new version (2). Version 1 is [[/v1|here]].
* This is version 0.2 (originally designated version 2, but renumbered in 2020) of the Forms classes.
* It was rewritten from scratch in 2015, superseding [[Ferreteria/v0.1]].
* It is superseded by [[Ferreteria/v0.3]].
==Subpages==
* [[/creating]]
* [[/displaying]]
{| width=100%
{| width=100%
| valign=top bgcolor=#efe |
| valign=top bgcolor=#efe |
Line 12: Line 19:
*** '''fcFormControl_HTML''' &larr; fcFormControl
*** '''fcFormControl_HTML''' &larr; fcFormControl
**** '''fcFormControl_HTML_TextArea''' &larr; fcFormControl_HTML
**** '''fcFormControl_HTML_TextArea''' &larr; fcFormControl_HTML
**** '''fcFormControl_HTML_Hidden''' &larr; fcFormControl_HTML
**** '''fcFormControl_HTML_DropDown''' &larr; fcFormControl_HTML
**** '''fcFormControl_HTML_CheckBox''' &larr; fcFormControl_HTML
* {{ferreteria/code|forms/field.php}}
* {{ferreteria/code|forms/field.php}}
** '''fcFormField'''
** '''fcFormField'''
Line 21: Line 31:
* {{ferreteria/code|forms/form-data.php}}
* {{ferreteria/code|forms/form-data.php}}
** '''fcForm_DB''' &larr; fcForm_keyed
** '''fcForm_DB''' &larr; fcForm_keyed
* {{ferreteria/code|db/v1/menu-data.php}}
** '''clsDataRecord_admin''' &larr; clsDataSet
| valign=top bgcolor=#eef |
| valign=top bgcolor=#eef |
==Classes==
==Classes==
Line 32: Line 44:
** '''fcFormControl_HTML''' &larr; fcFormControl
** '''fcFormControl_HTML''' &larr; fcFormControl
*** '''fcFormControl_HTML_TextArea''' &larr; fcFormControl_HTML
*** '''fcFormControl_HTML_TextArea''' &larr; fcFormControl_HTML
*** '''fcFormControl_HTML_Hidden''' &larr; fcFormControl_HTML
*** '''fcFormControl_HTML_DropDown''' &larr; fcFormControl_HTML
*** '''fcFormControl_HTML_CheckBox''' &larr; fcFormControl_HTML
* '''clsDataRecord_admin'''
|}
|}
==Significant Functions==
==Significant Functions==
Line 38: Line 54:
** ControlObject({{arg|name}},{{arg|control object (optional)}}) - set/get control object for given name
** ControlObject({{arg|name}},{{arg|control object (optional)}}) - set/get control object for given name
** AddField({{arg|field object}}, {{arg|control object}})
** AddField({{arg|field object}}, {{arg|control object}})
** LoadRecord() (abstract)
** abstract LoadRecord()
** SaveRecord() (abstract)
** abstract SaveRecord()
** RecordValue({{arg|name}},{{arg|value (optional)}}) - set/get field value
** RecordValue({{arg|name}},{{arg|value (optional)}}) - set/get field value
** RecordValues({{arg|array of values (optional)}}) - set/get all field values
** RecordValues({{arg|array of values (optional)}}) - set/get all field values
Line 45: Line 61:
** ClearValues()
** ClearValues()
** RenderControls({{arg|edit?}})
** RenderControls({{arg|edit?}})
* '''fcForm_keyed'''
** Get_KeyString_loaded()
** Set_KeyString_loaded({{arg|key string}})
** Get_KeyString_toSave()
** Set_KeyString_toSave({{arg|key string}})
** HasKey()
* '''fcForm_DB'''
** RecordsObject({{arg|recordset object (optional)}}) - set/get recordset object
** RecordValues_SQL() - get array of SQL-ready record values
** LoadRecord()
** SaveRecord()
* '''fcFormField'''
** FormObject({{arg|form object (optional)}}) - set/get form object
** NameString({{arg|name string (optional)}}) - set/get field's name
** ValueNative({{arg|value string (optional)}}) - set/get field's internal value
** ValueDisplay({{arg|value string (optional)}}) - set/get field's display value
** ValueSQL({{arg|value string (optional)}}) - set/get field's SQL value
** static Convert_DisplayToNative({{arg|value string}})
** static Convert_NativeToDisplay({{arg|value string}})
** static Convert_SQLToNative({{arg|value string}})
** static Convert_NativeToSQL({{arg|value string}})
* '''fcFormControl'''
** FormObject({{arg|form object (optional)}}) - set/get form object
** FieldObject({{arg|field object (optional)}}) - set/get field object
** abstract Render({{arg|edit?}})
* '''clsDataRecord_admin'''
** callbacks:
*** AdminRows(array $arFields,array $arOptions=NULL)
*** AdminRows_none(array $arOptions=NULL) - called if there are no rows
*** AdminRows_start(array $arOptions=NULL) - called before first row; by default, opens an HTML table
*** AdminRows_finish(array $arOptions=NULL) - called after last row; by default, closes the HTML table
*** AdminRows_after(array $arOptions=NULL) - called just before AdminRows() exits, regardless of whether there were rows
*** AdminRows_head(array $arFields,array $arOptions=NULL) - called after AdminRows_start(); by default, displays row headers
*** AdminRows_rows(array $arFields,array $arOptions=NULL) - called before AdminRows_finish(); useful for displaying totals
*** AdminField($sField,array $arOptions=NULL) - called for each field to display in AdminRows()

Latest revision as of 16:46, 22 May 2022

About

This page may be slightly out of date, e.g. class names may have changed.

Forms in Ferreteria consist of several sets of classes that work together:

  • control classes render editable (and eventually non-editable) data fields
  • field classes handle translating values between internal storage and on-disk storage (database)

Status

  • This is version 0.2 (originally designated version 2, but renumbered in 2020) of the Forms classes.
  • It was rewritten from scratch in 2015, superseding Ferreteria/v0.1.
  • It is superseded by Ferreteria/v0.3.

Subpages

Files

Classes

  • fcForm (abstract)
    • fcForm_keyed ← fcForm
      • fcForm_DB ← fcForm_keyed
  • fcFormField
    • fcFormField_Num ← fcFormField
    • fcFormField_Time ← fcFormField
  • fcFormControl (abstract)
    • fcFormControl_HTML ← fcFormControl
      • fcFormControl_HTML_TextArea ← fcFormControl_HTML
      • fcFormControl_HTML_Hidden ← fcFormControl_HTML
      • fcFormControl_HTML_DropDown ← fcFormControl_HTML
      • fcFormControl_HTML_CheckBox ← fcFormControl_HTML
  • clsDataRecord_admin

Significant Functions

  • fcForm
    • ControlArray(<array of control objects (optional)>) - set/get all control objects
    • ControlObject(<name>,<control object (optional)>) - set/get control object for given name
    • AddField(<field object>, <control object>)
    • abstract LoadRecord()
    • abstract SaveRecord()
    • RecordValue(<name>,<value (optional)>) - set/get field value
    • RecordValues(<array of values (optional)>) - set/get all field values
    • NewValues(<array of values (optional)>) - set/get values for new records
    • ClearValues()
    • RenderControls(<edit?>)
  • fcForm_keyed
    • Get_KeyString_loaded()
    • Set_KeyString_loaded(<key string>)
    • Get_KeyString_toSave()
    • Set_KeyString_toSave(<key string>)
    • HasKey()
  • fcForm_DB
    • RecordsObject(<recordset object (optional)>) - set/get recordset object
    • RecordValues_SQL() - get array of SQL-ready record values
    • LoadRecord()
    • SaveRecord()
  • fcFormField
    • FormObject(<form object (optional)>) - set/get form object
    • NameString(<name string (optional)>) - set/get field's name
    • ValueNative(<value string (optional)>) - set/get field's internal value
    • ValueDisplay(<value string (optional)>) - set/get field's display value
    • ValueSQL(<value string (optional)>) - set/get field's SQL value
    • static Convert_DisplayToNative(<value string>)
    • static Convert_NativeToDisplay(<value string>)
    • static Convert_SQLToNative(<value string>)
    • static Convert_NativeToSQL(<value string>)
  • fcFormControl
    • FormObject(<form object (optional)>) - set/get form object
    • FieldObject(<field object (optional)>) - set/get field object
    • abstract Render(<edit?>)
  • clsDataRecord_admin
    • callbacks:
      • AdminRows(array $arFields,array $arOptions=NULL)
      • AdminRows_none(array $arOptions=NULL) - called if there are no rows
      • AdminRows_start(array $arOptions=NULL) - called before first row; by default, opens an HTML table
      • AdminRows_finish(array $arOptions=NULL) - called after last row; by default, closes the HTML table
      • AdminRows_after(array $arOptions=NULL) - called just before AdminRows() exits, regardless of whether there were rows
      • AdminRows_head(array $arFields,array $arOptions=NULL) - called after AdminRows_start(); by default, displays row headers
      • AdminRows_rows(array $arFields,array $arOptions=NULL) - called before AdminRows_finish(); useful for displaying totals
      • AdminField($sField,array $arOptions=NULL) - called for each field to display in AdminRows()