Class input_form

Description

Input form class.

This class defines an input form and has methods for adding form objects to the form, displaying the form, and requesting the forms state.

  • version: $Revision: 1.4 $

Located in /input.form.php (line 36)


	
			
Variable Summary
 string $cancel
 string $location
 int $method
 string $name
 array $objects
 string $reset
 string $submit
Method Summary
 input_form input_form (string $name, [string $location = NULL], [mixed $method = INFUSE_POST], [string $submit = INFUSE_FORM_DEFAULT_SUBMIT], [string $reset = INFUSE_FORM_DEFAULT_RESET], [string $cancel = INFUSE_FORM_DEFAULT_CANCEL])
 bool addObject (object $object)
 void addSubmitButton (string $name, string $caption)
 bool addToGroup (string $group, object $object)
 bool cancelled ()
 void clearPost ()
 void display_buttons ([string $button_class = NULL])
 void display_end ()
 void display_start ([string $form_class = NULL])
 void otherSubmitted (string $name)
 void reset ([string $group = NULL])
 bool submitted ()
 method _constantToString ()
 void _dispArray (mixed &$elemArray)
 INFUSE_FORM, _parmToConstant (mixed $in_parm)
 void _resetArray (mixed &$objArray)
Variables
bool $areRequiredValid (line 106)

True if all required form elements are valid

string $cancel (line 84)

Caption of the cancel button.

bool $isFormValid (line 99)

Overall validity of form elements True if all added form elements are valid

string $location (line 50)

URI for form to submit to.

int $method (line 57)

The submit method to use: INFUSE_POST or INFUSE_GET

string $name (line 43)

The name of the form.

array $objects = array() (line 91)

Form objects in this form.

array $other_submit = array() (line 70)

Additional submit buttons

string $reset (line 77)

Caption of the reset button.

string $submit (line 64)

Caption of the submit button.

Methods
Constructor input_form (line 118)

Constructs a new form object.

input_form input_form (string $name, [string $location = NULL], [mixed $method = INFUSE_POST], [string $submit = INFUSE_FORM_DEFAULT_SUBMIT], [string $reset = INFUSE_FORM_DEFAULT_RESET], [string $cancel = INFUSE_FORM_DEFAULT_CANCEL])
  • string $name: The name of the form.
  • string $location: URI for form to submit to.
  • mixed $method: The submit method to use ('get', 'post', INFUSE_GET, INFUSE_POST)
  • string $submit: Caption of the submit button.
  • string $reset: Caption of the reset button.
  • string $cancel: Caption of the cancel button.
addObject (line 187)

Add a form object to the form.

  • return: TRUE on success.
bool addObject (object $object)
  • object $object: The form object to add.
addSubmitButton (line 241)

Add additional submit button.

void addSubmitButton (string $name, string $caption)
  • string $name: "Functional" name of button, e.g. edit_button.
  • string $caption: "Display" name of button, e.g. Edit
addToGroup (line 215)

Add to a group of elements under one name ( nested array )

  • return: TRUE on success.
bool addToGroup (string $group, object $object)
  • string $group: Name of element group
  • object $object: The form object to add.
cancelled (line 276)

Has the form been cancelled? Can be called statically.

  • return: TRUE if the form has been cancelled
bool cancelled ()
clearPost (line 287)

Clear form post values.

void clearPost ()
display_buttons (line 347)

Display configured form buttons using optional specified class.

Buttons are displayed in the following order: Submit Other submit (preview, edit, delete, whatever) two   if reset or cancel buttons are present Reset (if present) Cancel (if present)

name and id attributes are both assigned as follows: submit: <form name>_submit other submit: <form name>_<other name> (e.g. user_edit) reset: <form name>_reset cancel: input_form_cancel <-- only need one cancel button.

void display_buttons ([string $button_class = NULL])
  • string $button_class: Name of class assigned to span tag surrounding buttons.
display_elements (line 325)

Basic display of form elements. Very crude. Your own templates can do better...

void display_elements ()
display_end (line 397)

Display the closing form tag.

void display_end ()
display_start (line 308)

Display the form header.

Displays the beginning of the form in xhtml compliant fashion with the following attributes:

enctype multipart/form-data id assigned form name method get/post action assigned location class class passed as parameter, if any

This method should be used in conjunction with input_form::display_end.

void display_start ([string $form_class = NULL])
  • string $form_class: CSS class to be assigned to this form
otherSubmitted (line 250)

Has the form been submitted with one of the 'other' buttons?

void otherSubmitted (string $name)
  • string $name: "Functional" name of button to check, e.g. edit_button
reset (line 145)

Calls reset all form elements

void reset ([string $group = NULL])
  • string $group: Name of specific group of elements to reset
submitted (line 263)

Has the form been submitted?

  • return: TRUE if the form has been submitted.
bool submitted ()
_constantToString (line 466)

Convert constants to appropriate method string for rendered form.

  • return: string 'post' or 'get'
method _constantToString ()
_dispArray (line 409)

Print array elements within a table.

  • access: private
void _dispArray (mixed &$elemArray)
  • mixed $elemArray: Reference to element array to display
_parmToConstant (line 441)

Convert input parameters to defined constants for form method.

  • return: INFUSE_POST, or INFUSE_GET
  • access: private
INFUSE_FORM, _parmToConstant (mixed $in_parm)
  • mixed $in_parm: String or constant specifying where form input can be found.
_resetArray (line 163)

Utility function Reset contents of given array

  • access: private
void _resetArray (mixed &$objArray)
  • mixed $objArray: Reference to array to reset.

Documentation generated on Fri, 28 Jan 2005 10:00:56 -0800 by phpDocumentor 1.2.3