Docs For Class FormProcessor

## Class FormProcessor

Description

This is the main engine for the processing

of Forms. It builds the form tag, and calls the appropriate FormContent methods to build the FormElement's and validation, as well as backend processing to do the action after the data has been validated.

- author: Walter A. Boring IV <waboring@newsblob.com>

Located in /form/FormProcessor.inc (line 31)

    Container
       |
       --FormProcessor

Direct descendents

Class | Description
--- | ---
FormWizard | This is a magic container that allows you to chain together multiple FormContent objects to automatically create a Wizard process.

Variable Summary
mixed $_auto_show_errors
mixed $_confirmed
mixed $_confirmed_successfull
mixed $_FormValidation
mixed $_form_attributes
mixed $_form_content
mixed $_form_submit_action
mixed $_form_success_render
mixed $_has_errors
Method Summary
FormProcessor FormProcessor (FormContent &$form_content, [string $form_name = "myform"], [mixed $form_action = NULL])
BOOLEAN can_validate ()
void do_validation ()
string get_action ()
boolean get_auto_error_display ()
array get_error_array ()
object &get_error_display_object ()
string get_form_action ()
string get_form_enctype ()
string get_form_method ()
string get_form_name ()
string get_form_target ()
string get_onsubmit ()
boolean has_errors ()
boolean is_action_successfull ()
void render (mixed $indent_level, mixed $output_debug)
string render_confirm (int $indent_level, int $output_debug)
raw render_error (array $indent_level, array $output_debug, int 2, int 3)
raw render_form (the $indent_level, int $output_debug, [int $obj = NULL], object - 3)
void setup_validation ()
void set_auto_error_display ([boolean $flag = TRUE])
void set_form_action (string $action)
void set_form_attribute (string $key, string $value)
void set_form_enctype (string $enctype)
void set_form_method (string $method)
void set_form_name (string $name)
void set_form_target (string $target)
none set_onsubmit (string $js)
void set_render_form_after_success ([mixed $flag = TRUE])
void _add_confirm_data ()
void _add_hidden_fields ()
FORMtag _build_form_tag ()
string _build_javascript ()
none _init_form_content ()
void _pre_confirm ()
void _process_action ()
void _process_form ()
void _set_action ()
void _set_confirmed_success ([boolean $flag = TRUE])
void __hidden_fields ()
Variables
mixed $_auto_show_errors = TRUE (line 99)

This tells us to show or not to show the form errors autmatically.

The user of the FormProcessor may want to deal with errors manually

mixed $_confirmed = FALSE (line 65)

Flag to let us know the form has been confirmed.

mixed $_confirmed_successfull = FALSE (line 91)

The form was processed and passed

the confirmation if any, and it was successfull ?

mixed $_FormValidation = NULL (line 78)

This is the FormValidation object

used to validate the form elements

mixed $_form_attributes = array("method" => "post",
"action" => "",
"name" => "myform",
"target" => "",
"onsubmit" => "",
"style" => "margin: 0px 0px 0px 0px;") (line 39)

This array holds the FORMtag

attributes for this form

mixed $_form_content = NULL (line 51)

This holds the FormContent Object that knows how to render the form.

mixed $_form_submit_action = NULL (line 84)

The action that was taken

for the form

mixed $_form_success_render = TRUE (line 72)

Flag to let us know if we should

render the form after it was successfully processed

mixed $_has_errors = FALSE (line 59)

This flag lets us know there were errors during processing or validating the form.

Methods
Constructor FormProcessor (line 108)

The constructor for the FormProcessor

FormProcessor FormProcessor (FormContent &$form_content, [string $form_name = "myform"], [mixed $form_action = NULL])

- FormContent &$form_content: object
- string $form_name: the form name

can_validate (line 415)

This method lets us turn on/off the ability to do validation for the form

BOOLEAN can_validate ()
do_validation (line 239)

This method walks the FormContent's visible elements

and calls the validation function for the element

void do_validation ()
get_action (line 641)

This is used to get the action that was processed by the form

string get_action ()
get_auto_error_display (line 472)

This gets the current value of the flag that tells us to show form errors automatically or not.

boolean get_auto_error_display ()
get_error_array (line 501)

This method returns an array of errors that happened in the form.

array get_error_array ()
get_error_display_object (line 486)

This method allows us to get access to the errors display object that is generated by the form content. This is the display object that is meant to be rendered directly.

If there are no errors. we will return NULL

object &get_error_display_object ()
get_form_action (line 601)

This function is used to get the form action

- return: (POST or GET)

string get_form_action ()
get_form_enctype (line 620)

This function is used to get the form enctype value

string get_form_enctype ()
get_form_method (line 582)

This function is used to get the form method

- return: (POST or GET)

string get_form_method ()
get_form_name (line 538)

This function is used to get the form name

string get_form_name ()
get_form_target (line 558)

This function is used to get the form target

string get_form_target ()
get_onsubmit (line 665)

Gets the current value of the form tag's onsubmit value

string get_onsubmit ()
has_errors (line 511)

This returns the flag that tells us that the form has errors during processing

boolean has_errors ()
is_action_successfull (line 439)

This is used to test to see if the form action was processed succesfully.

This is usefull for external entities to determine if the form was processed, and it was successfull.

boolean is_action_successfull ()
render (line 261)

This method is called to render the form's html

void render (mixed $indent_level, mixed $output_debug)

Redefinition of:

Container::render()
  This function is compatible with the rest of the phpHtmllib API spec.

Redefined in descendants as:

- FormWizard::render() : This function renders the

render_confirm (line 357)

This function renders the confirmation page. This page sits in between the front end form, and the action handler.

This only gets called after a form and its data has been successfully validated.

- return: - the raw html

string render_confirm (int $indent_level, int $output_debug)

- int $indent_level: - $indent_level
- int $output_debug: - $output_debug

Redefined in descendants as:

- FormWizard::render_confirm() : This function renders the confirmation page. This page sits in between the front end form, and the action handler.

render_error (line 386)

This renders the error table and then the form with the fields

- return: html

raw render_error (array $indent_level, array $output_debug, int 2, int 3)

- int 2: - $indent_level
- int 3: - $output_debug
- array $indent_level: - the form field vlues.
- array $output_debug: - array of errors.

render_form (line 307)

This renders the form

- return: html

raw render_form (the $indent_level, int $output_debug, [int $obj = NULL], object - 3)

- object - 3: the form errors object.
- the $indent_level: FormContent->form() object
- int $output_debug: - $indent_level
- int $obj: - $output_debug

setup_validation (line 140)

This function is used to setup the validation object and the form errors object that is to be used by this form.

You can override this method to use a different FormErrors object for localization.

void setup_validation ()

Redefined in descendants as:

- FormWizard::setup_validation() : This function is used to setup the validation object and the form errors object that is to be used by this form.

set_auto_error_display (line 461)

This sets the flag that tells this class to automatically call the form contents form errors and display it or not

void set_auto_error_display ([boolean $flag = TRUE])

- boolean $flag: - show errors?

set_form_action (line 591)

Sets the form action

void set_form_action (string $action)

- string $action

set_form_attribute (line 678)

Set a random attribute on the form tag.

You should know what you are doing as this might invalidate the output html with the W3C validator.

void set_form_attribute (string $key, string $value)

- string $key: the key
- string $value: the value

set_form_enctype (line 610)

Sets the form enctype

void set_form_enctype (string $enctype)

- string $enctype

set_form_method (line 568)

This function is used to set the form method

void set_form_method (string $method)

- string $method: (POST or GET)

set_form_name (line 528)

This function is used to set the form name

void set_form_name (string $name)

- string $name

set_form_target (line 548)

This function is used to set the form target

void set_form_target (string $target)

- string $target

set_onsubmit (line 655)

Set the onsubmit attribute to the form NOTE: The FormContent child can automatically set this value depending on the FormElement children it contains.

none set_onsubmit (string $js)

- string $js

set_render_form_after_success (line 427)

This function turns on the ability to

render the form after the success of the action. Normally this feature is off

void set_render_form_after_success ([mixed $flag = TRUE])
_add_confirm_data (line 761)

This adds all of the submitted data as

hidden form fields

void _add_confirm_data ()
_add_hidden_fields (line 783)

This function adds the form content's

hidden form fields to the form automatically

void _add_hidden_fields ()
_build_form_tag (line 718)

this function builds the FORMtag object and its attributes.

- return: object.

FORMtag _build_form_tag ()

Redefined in descendants as:

- FormWizard::_build_form_tag() : Override this so that we can place the toolbar first inside the form tag. We also have to make sure the onsubmit stuff is working properly.

_build_javascript (line 819)

This method is used to build any Javascript that is used by the form and/or the form elements used in the form.

string _build_javascript ()
_init_form_content (line 693)

This method initializes the FormContent during processing.

none _init_form_content ()
_pre_confirm (line 219)

This method calls the FormContent

to let it do any data munging before the confirmation page is rendered

void _pre_confirm ()
_process_action (line 209)

This function is responsible for processing the form action after validation, and form confirmation happens.

void _process_action ()
_process_form (line 149)

This method does the logic of

doing the form processing

void _process_form ()

Redefined in descendants as:

- FormWizard::_process_form() : This method does the logic of

_set_action (line 630)

This is used to set the action

submitted by the user

void _set_action ()
_set_confirmed_success (line 450)

This flag sets the flag that tells if we successfully confirmed the form, and processed the action

void _set_confirmed_success ([boolean $flag = TRUE])

- boolean $flag

__hidden_fields (line 796)

This method adds the processor specific hidden fields.

void __hidden_fields ()

Redefined in descendants as:

- FormWizard::__hidden_fields()

#### Inherited Methods

Inherited From Container

> Container::Container()
> Container::add()
> Container::add_reference()
> Container::count_content()
> Container::get_element()
> Container::get_indent_flag()
> Container::push()
> Container::push_reference()
> Container::render()
> Container::reset_content()
> Container::set_collapse()
> Container::set_indent_flag()

Documentation generated on Thu, 1 Sep 2005 17:06:00 -0700 by phpDocumentor 1.3.0RC3