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.

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

Container
   |
   --FormProcessor
Direct descendents
Class Description
FormWizard This is the main engine for the processing
Variable Summary
Method Summary
void FormProcessor (FormContent &$form_content, [string $form_name = "myform"], [mixed $form_action = NULL])
BOOLEAN can_validate ()
void do_validation ()
string get_action ()
array get_error_array ()
string get_form_action ()
string get_form_enctype ()
string get_form_method ()
string get_form_name ()
string get_form_target ()
boolean has_errors ()
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 set_auto_error_display ([boolean $flag = TRUE])
void set_form_action (string $action)
void set_form_enctype (string $enctype)
void set_form_method (string $method)
void set_form_name (string $name)
void set_form_target (string $target)
void set_render_form_after_success ([mixed $flag = TRUE])
string _build_javascript ()
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.

Inherited Variables

Inherited from Container

Container::$_flags
Methods
Constructor FormProcessor (line 108)

The constructor for the FormProcessor

void 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 408)

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 634)

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

string get_action ()
get_auto_error_display (line 465)

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 494)

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

array get_error_array ()
get_error_display_object (line 479)

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 594)

This function is used to get the form action

  • return:

    (POST or GET)

string get_form_action ()
get_form_enctype (line 613)

This function is used to get the form enctype value

string get_form_enctype ()
get_form_method (line 575)

This function is used to get the form method

  • return:

    (POST or GET)

string get_form_method ()
get_form_name (line 531)

This function is used to get the form name

string get_form_name ()
get_form_target (line 551)

This function is used to get the form target

string get_form_target ()
has_errors (line 504)

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

boolean has_errors ()
is_action_successfull (line 432)

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 254)

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:
render_confirm (line 350)

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 379)

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 300)

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 ()
set_auto_error_display (line 454)

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 584)

Sets the form action

void set_form_action (string $action)
  • string $action
set_form_enctype (line 603)

Sets the form enctype

void set_form_enctype (string $enctype)
  • string $enctype
set_form_method (line 561)

This function is used to set the form method

void set_form_method (string $method)
  • string $method:

    (POST or GET)

set_form_name (line 521)

This function is used to set the form name

void set_form_name (string $name)
  • string $name
set_form_target (line 541)

This function is used to set the form target

void set_form_target (string $target)
  • string $target
set_render_form_after_success (line 420)

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 660)

This adds all of the submitted data as

hidden form fields

void _add_confirm_data ()
_add_hidden_fields (line 688)

This function adds the form content's

hidden form fields to the form automatically

void _add_hidden_fields ()
_build_form_tag (line 645)

this function builds the FORMtag object and its attributes.

  • return:

    object.

FORMtag _build_form_tag ()
_build_javascript (line 724)

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 ()
_pre_confirm (line 229)

This method calls the FormContent

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

void _pre_confirm ()
_process_action (line 219)

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

void _process_action ()
_process_form (line 148)

This method does the logic of

doing the form processing

void _process_form ()

Redefined in descendants as:
_set_action (line 623)

This is used to set the action

submitted by the user

void _set_action ()
_set_confirmed_success (line 443)

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 701)

This method adds the processor specific hidden fields.

void __hidden_fields ()

Redefined in descendants as:

Inherited Methods

Inherited From Container

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

Documention generated on Thu, 31 Jul 2003 18:32:44 -0700 by phpDocumentor 1.2.0