Class Horde_Form

Description

Horde_Form Master Class.

The Horde_Form:: package provides form rendering, validation, and other functionality for the Horde Application Framework.

$Horde: framework/Form/Form.php,v 1.306.2.80 2010-10-10 21:16:29 jan Exp $

Copyright 2001-2007 Robert E. Coyle <robertecoyle@hotmail.com> Copyright 2001-2009 The Horde Project (http://www.horde.org/)

See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.

Located in /Form/Form.php (line 28)


	
			
Direct descendents
Class Description
 class HordeSignupForm Horde Signup Form.
 class ConfigForm A Horde_Form:: form that implements a user interface for the config system.
Variable Summary
 mixed $_autofilled
 mixed $_enctype
 mixed $_errors
 mixed $_extra
 mixed $_help
 mixed $_name
 mixed $_reset
 mixed $_sections
 mixed $_submit
 mixed $_submitted
 mixed $_title
 mixed $_variables
 mixed $_vars
Method Summary
 Horde_Form __construct ( $vars, [ $title = ''], [ $name = null])
 Horde_Form Horde_Form ( &$vars, [ $title = ''], [ $name = null])
 void &addHidden ( $humanName,  $varName,  $type,  $required, [ $readonly = false], [ $description = null], [ $params = array()])
 void &addVariable ( $humanName,  $varName,  $type,  $required, [ $readonly = false], [ $description = null], [ $params = array()])
 void appendButtons ( $submit)
 void clearError ( $var)
 void clearValidation ()
 void close ( $renderer)
 void execute ()
 void getError ( $var)
 void getExtra ()
 void getInfo (Variables $vars,  &$info, array $info)
 void getName ()
 void getOpenSection ()
 object Horde_Form_Renderer &getRenderer ([array $params = array()])
 void getSectionDesc ( $section)
 void getSectionExpandedState ( $section, [ $boolean = false])
 void getSectionImage ( $section)
 void getTitle ()
 void &getType ( $type, [ $params = array()])
 void &getVariables ([ $flat = true], [ $withHidden = false])
 void hasHelp ()
 void &insertVariableBefore ( $before,  $humanName,  $varName,  $type,  $required, [ $readonly = false], [ $description = null], [ $params = array()])
 boolean isSubmitted ()
 void isValid ()
 void onSubmit ( &$vars, Horde_Variables $vars)
 void open ( &$renderer,  &$vars,  $action, [ $method = 'get'], [ $enctype = null])
 void preserve ( $vars)
 void preserveVarByPost ( &$vars,  $varname, [ $alt_varname = ''])
 boolean removeVariable ( &$var, Horde_Form_Variable|string $var)
 void renderActive ([Horde_Form_Renderer $renderer = null], [Variables $vars = null], [string $action = ''], [string $method = 'get'], [string $enctype = null], [boolean $focus = true])
 void renderInactive ([Horde_Form_Renderer $renderer = null], [Variables $vars = null])
 void setButtons ( $submit, [ $reset = false])
 void setError ( $var,  $message)
 void setExtra ( $extra)
 void setOpenSection ( $section)
 void setSection ([ $section = ''], [ $desc = ''], [ $image = ''], [ $expanded = true])
 void setSubmitted ([boolean $state = true])
 void setTitle ( $title)
 void setVars ( &$vars)
 void &singleton ( $form,  &$vars, [ $title = ''], [ $name = null])
 void unsetVars ( &$vars)
 boolean useToken ([boolean $token = null])
 boolean validate ([Variables $vars = null], [ $canAutoFill = false], boolean $canAutofill)
Variables
mixed $_autofilled = false (line 44)
mixed $_currentSection = array() (line 40)
mixed $_enctype = null (line 45)
mixed $_errors = array() (line 36)
mixed $_extra = '' (line 32)
mixed $_help = false (line 46)
mixed $_hiddenVariables = array() (line 42)
mixed $_name = '' (line 30)
mixed $_open_section = null (line 39)
mixed $_reset = false (line 35)
mixed $_sections = array() (line 38)
mixed $_submit = array() (line 34)
mixed $_submitted = null (line 37)
mixed $_title = '' (line 31)
mixed $_useFormToken = true (line 43)

Redefined in descendants as:
mixed $_variables = array() (line 41)
mixed $_vars (line 33)

Redefined in descendants as:
Methods
Constructor __construct (line 59)
Horde_Form __construct ( $vars, [ $title = ''], [ $name = null])
  • $vars
  • $title
  • $name
Constructor Horde_Form (line 48)
Horde_Form Horde_Form ( &$vars, [ $title = ''], [ $name = null])
  • &$vars
  • $title
  • $name
addHidden (line 313)

TODO

void &addHidden ( $humanName,  $varName,  $type,  $required, [ $readonly = false], [ $description = null], [ $params = array()])
  • $humanName
  • $varName
  • $type
  • $required
  • $readonly
  • $description
  • $params
addVariable (line 218)

TODO

void &addVariable ( $humanName,  $varName,  $type,  $required, [ $readonly = false], [ $description = null], [ $params = array()])
  • $humanName
  • $varName
  • $type
  • $required
  • $readonly
  • $description
  • $params
appendButtons (line 363)
void appendButtons ( $submit)
  • $submit
clearError (line 680)
void clearError ( $var)
  • $var
clearValidation (line 655)
void clearValidation ()
close (line 438)
void close ( $renderer)
  • $renderer
execute (line 695)
void execute ()
getError (line 660)
void getError ( $var)
  • $var
getExtra (line 95)
void getExtra ()
getInfo (line 707)

Fetch the field values of the submitted form.

void getInfo (Variables $vars,  &$info, array $info)
  • Variables $vars: A Variables instance, optional since Horde 3.2.
  • array $info: Array to be filled with the submitted field values.
  • &$info

Redefined in descendants as:
getName (line 105)
void getName ()
getOpenSection (line 195)
void getOpenSection ()
getRenderer (line 147)

Get the renderer for this form, either a custom renderer or the standard one.

To use a custom form renderer, your form class needs to override this function:

  1.  function &getRenderer()
  2.  {
  3.      $r new CustomFormRenderer();
  4.      return $r;
  5.  }

... where CustomFormRenderer is the classname of the custom renderer class, which should extend Horde_Form_Renderer.

  • return: The form renderer.
object Horde_Form_Renderer &getRenderer ([array $params = array()])
  • array $params: A hash of renderer-specific parameters.
getSectionDesc (line 180)
void getSectionDesc ( $section)
  • $section
getSectionExpandedState (line 200)
void getSectionExpandedState ( $section, [ $boolean = false])
  • $section
  • $boolean
getSectionImage (line 185)
void getSectionImage ( $section)
  • $section
getTitle (line 85)
void getTitle ()
getType (line 154)
void &getType ( $type, [ $params = array()])
  • $type
  • $params
getVariables (line 325)
void &getVariables ([ $flat = true], [ $withHidden = false])
  • $flat
  • $withHidden
hasHelp (line 760)
void hasHelp ()
insertVariableBefore (line 230)

TODO

void &insertVariableBefore ( $before,  $humanName,  $varName,  $type,  $required, [ $readonly = false], [ $description = null], [ $params = array()])
  • $before
  • $humanName
  • $varName
  • $type
  • $required
  • $readonly
  • $description
  • $params
isSubmitted (line 777)

Determines if this form has been submitted or not. If the class var _submitted is null then it will check for the presence of the formname in the form variables.

Other events can explicitly set the _submitted variable to false to indicate a form submit but not for actual posting of data (eg. onChange events to update the display of fields).

  • return: True or false indicating if the form has been submitted.
boolean isSubmitted ()
isValid (line 690)
void isValid ()
onSubmit (line 796)

Checks if there is anything to do on the submission of the form by looping through each variable's onSubmit() function.

void onSubmit ( &$vars, Horde_Variables $vars)
  • Horde_Variables $vars
  • &$vars
open (line 404)
void open ( &$renderer,  &$vars,  $action, [ $method = 'get'], [ $enctype = null])
  • &$renderer
  • &$vars
  • $action
  • $method
  • $enctype
preserve (line 533)
void preserve ( $vars)
  • $vars
preserveVarByPost (line 372)
void preserveVarByPost ( &$vars,  $varname, [ $alt_varname = ''])
  • &$vars
  • $varname
  • $alt_varname
removeVariable (line 291)

Removes a variable from the form.

As only variables can be passed by reference, you need to call this method this way if want to pass a variable name:

  1.  $form->removeVariable($var 'varname');

  • return: True if the variable was found (and deleted).
boolean removeVariable ( &$var, Horde_Form_Variable|string $var)
  • Horde_Form_Variable|string $var: Either the variable's name or the variable to remove from the form.
  • &$var
renderActive (line 457)

Renders the form for editing.

void renderActive ([Horde_Form_Renderer $renderer = null], [Variables $vars = null], [string $action = ''], [string $method = 'get'], [string $enctype = null], [boolean $focus = true])
  • Horde_Form_Renderer $renderer: A renderer instance, optional since Horde 3.2.
  • Variables $vars: A Variables instance, optional since Horde 3.2.
  • string $action: The form action (url).
  • string $method: The form method, usually either 'get' or 'post'.
  • string $enctype: The form encoding type. Determined automatically if null.
  • boolean $focus: Focus the first form field?
renderInactive (line 518)

Renders the form for displaying.

void renderInactive ([Horde_Form_Renderer $renderer = null], [Variables $vars = null])
  • Horde_Form_Renderer $renderer: A renderer instance, optional since Horde 3.2.
  • Variables $vars: A Variables instance, optional since Horde 3.2.
setButtons (line 345)
void setButtons ( $submit, [ $reset = false])
  • $submit
  • $reset
setError (line 670)
void setError ( $var,  $message)
  • $var
  • $message
setExtra (line 100)
void setExtra ( $extra)
  • $extra
setOpenSection (line 190)
void setOpenSection ( $section)
  • $section
setSection (line 169)
void setSection ([ $section = ''], [ $desc = ''], [ $image = ''], [ $expanded = true])
  • $section
  • $desc
  • $image
  • $expanded
setSubmitted (line 824)

Explicitly sets the state of the form submit.

An event can override the automatic determination of the submit state in the isSubmitted() function.

void setSubmitted ([boolean $state = true])
  • boolean $state: Whether to set the state of the form as being submitted.
setTitle (line 90)
void setTitle ( $title)
  • $title
setVars (line 80)
void setVars ( &$vars)
  • &$vars
singleton (line 64)
void &singleton ( $form,  &$vars, [ $title = ''], [ $name = null])
  • $form
  • &$vars
  • $title
  • $name
unsetVars (line 573)
void unsetVars ( &$vars)
  • &$vars
useToken (line 118)

Sets or gets whether the form should be verified by tokens.

Tokens are used to verify that a form is only submitted once.

  • return: Whether form tokens are being used.
boolean useToken ([boolean $token = null])
  • boolean $token: If specified, sets whether to use form tokens.
validate (line 592)

Validates the form, checking if it really has been submitted by calling isSubmitted() and if true does any onSubmit() calls for variable types in the form. The _submitted variable is then rechecked.

  • return: True if the form is valid.
boolean validate ([Variables $vars = null], [ $canAutoFill = false], boolean $canAutofill)
  • Variables $vars: A Variables instance, optional since Horde 3.2.
  • boolean $canAutofill: Can the form be valid without being submitted?
  • $canAutoFill

Documentation generated on Sun, 30 Jan 2011 05:17:27 +0000 by phpDocumentor 1.4.3