Limiting Forms: Difference between revisions
No edit summary |
No edit summary |
||
Line 5: | Line 5: | ||
*Form Relationships | *Form Relationships | ||
*Report Limits | *Report Limits | ||
==Form Storage== | |||
The methods of I2CE_Form add in the ability to limit values based on the storage mechanism. If you wish to create a new form storage mechanism with search capabilities, you will need to either produce some code to parse the limiting data structure described below or, if you storage mechanism is accessible to the database, you may simply subclass I2CE_FormStorage_Helper_DB. | The methods of I2CE_Form add in the ability to limit values based on the storage mechanism. If you wish to create a new form storage mechanism with search capabilities, you will need to either produce some code to parse the limiting data structure described below or, if you storage mechanism is accessible to the database, you may simply subclass I2CE_FormStorage_Helper_DB. | ||
=Limit Styles= | ==Limit Styles== | ||
There are many ways that you may wish to limit the values of a particular field, we refer to these as a '''limit style.''' For example, ''equals'' or ''like.'' | There are many ways that you may wish to limit the values of a particular field, we refer to these as a '''limit style.''' For example, ''equals'' or ''like.'' | ||
Line 13: | Line 14: | ||
Most of these limit style, and their attendant code, can be found in the module '''form-limits.''' | Most of these limit style, and their attendant code, can be found in the module '''form-limits.''' | ||
=Structure of Limiting Data= | ==Structure of Limiting Data== | ||
We allow, on a per-form basis, logical compounds of limits of any field through a nested array (or magic data) structure. The structure of a limit expression node is as follows: | We allow, on a per-form basis, logical compounds of limits of any field through a nested array (or magic data) structure. The structure of a limit expression node is as follows: | ||
*EXPRESSION NODE | *EXPRESSION NODE | ||
Line 20: | Line 21: | ||
=Existing Styles= | ==Existing Styles== | ||
These are the limit styles provided by ''form-limits'' version 3.2.0. Please see the class itself for more up-to-date information. | These are the limit styles provided by ''form-limits'' version 3.2.0. Please see the class itself for more up-to-date information. | ||
*I2CE_FormField | *I2CE_FormField |
Revision as of 08:33, 20 March 2009
In version 3.2 and greater we have unified the ability to search for forms by limiting the values of their fields. This is used in, for example:
- I2CE_Form::search()
- I2CE_Form::listFields()
- Form Relationships
- Report Limits
Form Storage
The methods of I2CE_Form add in the ability to limit values based on the storage mechanism. If you wish to create a new form storage mechanism with search capabilities, you will need to either produce some code to parse the limiting data structure described below or, if you storage mechanism is accessible to the database, you may simply subclass I2CE_FormStorage_Helper_DB.
Limit Styles
There are many ways that you may wish to limit the values of a particular field, we refer to these as a limit style. For example, equals or like.
Recall that every field is has a type, such as INT or INT_LIST, which translates to a class, such as I2CE_FormField_INT or I2CE_FormField_INT_LIST, all of which sub-class I2CE_FormField. A type is made available to some sub-class (as well as well of all of its sub-classes) of I2CE_FormField.
Most of these limit style, and their attendant code, can be found in the module form-limits.
Structure of Limiting Data
We allow, on a per-form basis, logical compounds of limits of any field through a nested array (or magic data) structure. The structure of a limit expression node is as follows:
- EXPRESSION NODE
Existing Styles
These are the limit styles provided by form-limits version 3.2.0. Please see the class itself for more up-to-date information.
- I2CE_FormField
- null
- not_null
- max_parent
- min_parent
- max_parent_form
- min_parent_form
- I2CE_FormField_BOOL
- truefalse
- true
- false
- I2CE_FormField_DB_DATE
- greaterthan_now
- lessthan_now
- I2CE_FormField_DB_INT
- between
- equals
- in
- greaterthan
- greaterthan_equals
- lessthan
- lessthan_equals
- I2CE_FormField_DB_STRING
- between
- equals
- in
- greaterthan
- greaterthan_equals
- lessthan
- lessthan_equals
- like
- I2CE_FormField_DB_TEXT
- between
- equals
- in
- greaterthan
- greaterthan_equals
- lessthan
- lessthan_equals
- like
- I2CE_FormField_YESNO
- yesno
- yes
- no