Overview

Packages

  • Form
  • None

Classes

  • Horde_Form
  • Horde_Form_Action
  • Horde_Form_Action_conditional_enable
  • Horde_Form_Action_conditional_setvalue
  • Horde_Form_Action_ConditionalEnable
  • Horde_Form_Action_ConditionalSetValue
  • Horde_Form_Action_reload
  • Horde_Form_Action_setcursorpos
  • Horde_Form_Action_submit
  • Horde_Form_Action_sum_fields
  • Horde_Form_Action_updatefield
  • Horde_Form_Renderer
  • Horde_Form_Translation
  • Horde_Form_Type
  • Horde_Form_Type_address
  • Horde_Form_Type_addresslink
  • Horde_Form_Type_assign
  • Horde_Form_Type_boolean
  • Horde_Form_Type_captcha
  • Horde_Form_Type_category
  • Horde_Form_Type_cellphone
  • Horde_Form_Type_colorpicker
  • Horde_Form_Type_countedtext
  • Horde_Form_Type_country
  • Horde_Form_Type_creditcard
  • Horde_Form_Type_date
  • Horde_Form_Type_datetime
  • Horde_Form_Type_dblookup
  • Horde_Form_Type_description
  • Horde_Form_Type_email
  • Horde_Form_Type_emailConfirm
  • Horde_Form_Type_enum
  • Horde_Form_Type_figlet
  • Horde_Form_Type_file
  • Horde_Form_Type_header
  • Horde_Form_Type_hourminutesecond
  • Horde_Form_Type_image
  • Horde_Form_Type_int
  • Horde_Form_Type_intlist
  • Horde_Form_Type_invalid
  • Horde_Form_Type_ip6address
  • Horde_Form_Type_ipaddress
  • Horde_Form_Type_keyval_multienum
  • Horde_Form_Type_link
  • Horde_Form_Type_longtext
  • Horde_Form_Type_matrix
  • Horde_Form_Type_mlenum
  • Horde_Form_Type_monthdayyear
  • Horde_Form_Type_monthyear
  • Horde_Form_Type_multienum
  • Horde_Form_Type_number
  • Horde_Form_Type_obrowser
  • Horde_Form_Type_octal
  • Horde_Form_Type_password
  • Horde_Form_Type_passwordconfirm
  • Horde_Form_Type_pgp
  • Horde_Form_Type_phone
  • Horde_Form_Type_radio
  • Horde_Form_Type_selectfiles
  • Horde_Form_Type_set
  • Horde_Form_Type_smime
  • Horde_Form_Type_sorter
  • Horde_Form_Type_sound
  • Horde_Form_Type_spacer
  • Horde_Form_Type_stringarray
  • Horde_Form_Type_stringlist
  • Horde_Form_Type_tableset
  • Horde_Form_Type_text
  • Horde_Form_Type_time
  • Horde_Form_Variable
  • Overview
  • Package
  • Class
  • Tree

Class Horde_Form

Horde_Form Master Class.

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

Copyright 2001-2007 Robert E. Coyle robertecoyle@hotmail.com Copyright 2001-2012 Horde LLC (http://www.horde.org/)

See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.

Package: Form
Author: Robert E. Coyle robertecoyle@hotmail.com
Author: Chuck Hagenbuch chuck@horde.org
Located at Horde/Form.php
Methods summary
public
# Horde_Form( mixed & $vars, mixed $title = '', mixed $name = null )
public
# __construct( mixed $vars, mixed $title = '', mixed $name = null )
public &
# singleton( mixed $form, mixed & $vars, mixed $title = '', mixed $name = null )
public
# setVars( mixed & $vars )
public
# getVars( )
public
# getTitle( )
public
# setTitle( mixed $title )
public
# getExtra( )
public
# setExtra( mixed $extra )
public
# getName( )
public boolean
# useToken( boolean $token = null )

Sets or gets whether the form should be verified by tokens. Tokens are used to verify that a form is only submitted once.

Sets or gets whether the form should be verified by tokens. Tokens are used to verify that a form is only submitted once.

Parameters

$token
If specified, sets whether to use form tokens.

Returns

boolean
Whether form tokens are being used.
public object
# getRenderer( array $params = array() )

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

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:

function &getRenderer()
{
    $r = new CustomFormRenderer();
    return $r;
}

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

Parameters

$params
A hash of renderer-specific parameters.

Returns

object
Horde_Form_Renderer The form renderer.
public
# getType( mixed $type, mixed $params = array() )

Throws

Horde_Exception
public
# setSection( mixed $section = '', mixed $desc = '', mixed $image = '', mixed $expanded = true )
public
# getSectionDesc( mixed $section )
public
# getSectionImage( mixed $section )
public
# setOpenSection( mixed $section )
public
# getOpenSection( )
public
# getSectionExpandedState( mixed $section, mixed $boolean = false )
public &
# addVariable( mixed $humanName, mixed $varName, mixed $type, mixed $required, mixed $readonly = false, mixed $description = null, mixed $params = array() )

TODO

TODO

public &
# insertVariableBefore( mixed $before, mixed $humanName, mixed $varName, mixed $type, mixed $required, mixed $readonly = false, mixed $description = null, mixed $params = array() )

TODO

TODO

public boolean
# removeVariable( Horde_Form_Variable|string & $var )

Removes a variable from the form.

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:

$form->removeVariable($var = 'varname');

Parameters

$var
<p>Either the variable's name or the variable to remove from the form.</p>

Returns

boolean
True if the variable was found (and deleted).
public &
# addHidden( mixed $humanName, mixed $varName, mixed $type, mixed $required, mixed $readonly = false, mixed $description = null, mixed $params = array() )

TODO

TODO

public &
# getVariables( mixed $flat = true, mixed $withHidden = false )
public
# setButtons( mixed $submit, mixed $reset = false )
public
# appendButtons( mixed $submit )
public
# preserveVarByPost( mixed & $vars, mixed $varname, mixed $alt_varname = '' )
public
# _preserveVarByPost( mixed $varname, mixed $value )
public
# open( mixed & $renderer, mixed & $vars, mixed $action, mixed $method = 'get', mixed $enctype = null )
public
# close( mixed $renderer )
public
# renderActive( Horde_Form_Renderer $renderer = null, Variables $vars = null, string $action = '', string $method = 'get', string $enctype = null, boolean $focus = true )

Renders the form for editing.

Renders the form for editing.

Parameters

$renderer
<p>A renderer instance, optional since Horde 3.2.</p>
$vars
<p>A Variables instance, optional since Horde 3.2.</p>
$action
The form action (url).
$method
<p>The form method, usually either 'get' or 'post'.</p>
$enctype
<p>The form encoding type. Determined automatically if null.</p>
$focus
Focus the first form field?
public
# renderInactive( Horde_Form_Renderer $renderer = null, Variables $vars = null )

Renders the form for displaying.

Renders the form for displaying.

Parameters

$renderer
<p>A renderer instance, optional since Horde 3.2.</p>
$vars
<p>A Variables instance, optional since Horde 3.2.</p>
public
# preserve( mixed $vars )
public
# unsetVars( mixed & $vars )
public boolean
# validate( Variables $vars = null, boolean $canAutoFill = false )

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.

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.

Parameters

$vars
<p>A Variables instance, optional since Horde 3.2.</p>
$canAutoFill
<p>Can the form be valid without being submitted?</p>

Returns

boolean
True if the form is valid.
public
# clearValidation( )
public
# getErrors( )
public
# getError( mixed $var )
public
# setError( mixed $var, mixed $message )
public
# clearError( mixed $var )
public
# isValid( )
public
# execute( )
public
# getInfo( Variables $vars, array & $info )

Fetch the field values of the submitted form.

Fetch the field values of the submitted form.

Parameters

$vars
A Variables instance, optional since Horde 3.2.
$info
<p>Array to be filled with the submitted field values.</p>
public
# _getInfoFromVariables( array $variables, object & $vars, array & $info )

Fetch the field values from a given array of variables.

Fetch the field values from a given array of variables.

Parameters

$variables
<p>An array of Horde_Form_Variable objects to fetch from.</p>
$vars
The Variables object.
$info
<p>The array to be filled with the submitted field values.</p>
public
# hasHelp( )
public boolean
# isSubmitted( )

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.

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

Returns

boolean

True or false indicating if the form has been submitted.

public
# onSubmit( Horde_Variables & $vars )

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

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

Parameters

$vars
public
# setSubmitted( boolean $state = true )

Explicitly sets the state of the form submit.

Explicitly sets the state of the form submit.

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

Parameters

$state
<p>Whether to set the state of the form as being submitted.</p>
Properties summary
public array $_sections
# array()
public boolean $_help
# false
API documentation generated by ApiGen