Ferreteria/v2/usage/forms: Difference between revisions
< Ferreteria | v2 | usage
Jump to navigation
Jump to search
(saving work) |
(the rest of the main classes) |
||
Line 4: | Line 4: | ||
* '''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) | ||
Code | Code files: | ||
* {{ferreteria/code|util/forms.php}} | |||
* {{ferreteria/code|form-data.php}} | |||
==Classes== | |||
The way this is organized is a little messed up; the descendants of clsCtrls handle database interaction -- but shouldn't it be the descendants of clsFields? It works reasonably well as is, but some rethinking might be a good idea, once everything is all mapped out. | |||
===collections=== | |||
* '''clsFields''': a collection of clsField objects | * '''clsCtrls''' (abstract): a collection of '''clsCtrl''' form controls -- often referred to in code as a "form object" | ||
** '''clsForm_recs''': form object that knows how to interact with a database table | |||
*** '''clsForm_recs_indexed''': form object that knows how to interact with a ''keyed'' database table (allowing for additional functionality) | |||
* '''clsFields''': a collection of '''clsField''' objects | |||
===unitary objects=== | |||
* '''clsField''': a generic (unspecialized) field, suitable for plain text | |||
** '''clsFieldTime''': field for storing date/time | |||
** '''clsFieldNum''': field for storing numeric (int or float) data | |||
** '''clsFieldBool''': field for storing a BIT-type boolean field (which, oddly, is returned as a single character instead of numeric) | |||
*** should be renamed clsFieldBool_bit, or maybe this class should be abstract and clsFieldBool_bit should descend from it | |||
*** '''clsFieldBool_Int''': field for storing a boolean value stored as an integer | *** '''clsFieldBool_Int''': field for storing a boolean value stored as an integer | ||
* ''' | * '''clsCtrl''' (abstract): a generic UI control | ||
** '''clsCtrlHTML''': a control for an HTML form, suitable for single-line text entry | |||
*** '''clsCtrlHTML_TextArea''': HTML multiline text entry control | |||
*** '''clsCtrlHTML_CheckBox''': HTML checkbox control | |||
*** '''clsCtrlHTML_DropDown''': HTML single-choice drop-down control | |||
*** '''clsCtrlHTML_Hidden''': HTML invisible control, for returning calculated data | |||
*** '''clsCtrlHTML_Fixed''': HTML control for displaying pre-set data; useful for creating new records | |||
*** '''clsCtrlHTML_ReadOnly''': HTML control for non-editable data | |||
*** '''clsCtrlHTML_Rating''': HTML control for entering a rating (integer with fixed range and intervals) |
Revision as of 20:46, 13 February 2015
About
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)
Code files:
Classes
The way this is organized is a little messed up; the descendants of clsCtrls handle database interaction -- but shouldn't it be the descendants of clsFields? It works reasonably well as is, but some rethinking might be a good idea, once everything is all mapped out.
collections
- clsCtrls (abstract): a collection of clsCtrl form controls -- often referred to in code as a "form object"
- clsForm_recs: form object that knows how to interact with a database table
- clsForm_recs_indexed: form object that knows how to interact with a keyed database table (allowing for additional functionality)
- clsForm_recs: form object that knows how to interact with a database table
- clsFields: a collection of clsField objects
unitary objects
- clsField: a generic (unspecialized) field, suitable for plain text
- clsFieldTime: field for storing date/time
- clsFieldNum: field for storing numeric (int or float) data
- clsFieldBool: field for storing a BIT-type boolean field (which, oddly, is returned as a single character instead of numeric)
- should be renamed clsFieldBool_bit, or maybe this class should be abstract and clsFieldBool_bit should descend from it
- clsFieldBool_Int: field for storing a boolean value stored as an integer
- clsCtrl (abstract): a generic UI control
- clsCtrlHTML: a control for an HTML form, suitable for single-line text entry
- clsCtrlHTML_TextArea: HTML multiline text entry control
- clsCtrlHTML_CheckBox: HTML checkbox control
- clsCtrlHTML_DropDown: HTML single-choice drop-down control
- clsCtrlHTML_Hidden: HTML invisible control, for returning calculated data
- clsCtrlHTML_Fixed: HTML control for displaying pre-set data; useful for creating new records
- clsCtrlHTML_ReadOnly: HTML control for non-editable data
- clsCtrlHTML_Rating: HTML control for entering a rating (integer with fixed range and intervals)
- clsCtrlHTML: a control for an HTML form, suitable for single-line text entry