root/trunk/docs/filters.txt

Revision 2, 1.3 kB (checked in by schst, 5 years ago)

initial import on new server

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 Filters:
2 -------
3 $Id$
4
5 Filters can be used to modify the value while it is sent to
6 the end user or when the end user sends a value to the form.
7
8 Filters are objects that supply at least the following three methods:
9
10 1. integer patForms_Filter::getType()
11 Returns the type of the filter, either PATFORMS_FILTER_TYPE_HTTP
12 or PATFORMS_FILTER_TYPE_PHP.
13 If a filter is of type HTTP, it is located between the patForms_Element
14 object and the browser of the user, that means the value will be filtered
15 directly when it has been submitted.
16
17 If a filter is of type PHP, it is located between the patForms_Element
18 and the PHP script you developed. That means after the form is submitted,
19 the value will be validated and only filtered, when you call
20 patForms_Element::getValue()
21
22 2. mixed in( mixed value )
23 This method is called when data is pushed to the patForms_Element object.
24 For PHP filters this is when you call patForms_Element::setValue(), or when
25 you have set a default value.
26 For HTTP filters, it is called when the user submitted data to the form.
27
28 3. mixed out( mixed value )
29 This method is called when data is pulled from the patForms_Element object.
30 For PHP filters this is when you call patForms_Element::getValue().
31 For HTTP filters, it is invoked when the form element is generated.
32
33 The easiest way to create a custom filter is to derive it from patForms_Filter.
Note: See TracBrowser for help on using the browser.