Class FormHelper

Description

Helpful functions for working with forms. Includes HTML input tags and the like

Located in /helpers/form.php (line 20)


	
			
Method Summary
 FormHelper __construct ()
 void action (string $action, [string $task = null])
 void button (string $name, string $value, [array $fields = array()], [ $additionalClasses = ''])
 string checkbox (string $field, string $value, [ $isChecked = false], [ $miscFields = array()], bool $checked)
 $html email (string $key, [string|array $valueOrArray = false], [array $miscFields = array()])
 void file (string $key)
 void getRequestValue ( $key)
 void hidden (string $key, [string $value = null])
 $html inputType (string $key, string $type, string|array $valueOrArray, array $miscFields)
 string label (string $field, string $name)
 string parseMiscFields (string $defaultClass, array $attributes)
 $html password (string $key, [string|array $valueOrArray = false], [array $miscFields = array()])
 void processRequestValue ( $key, [ $type = "post"])
 void radio (string $key,  $value, [ $valueOrArray = false], [ $miscFields = array()], string $valueOfButton, string $valueOfSelectedOption)
 $html search (string $key, [string|array $valueOrArray = false], [array $miscFields = array()])
 $html select (string $key,  $optionValues, [ $valueOrArray = false], [ $miscFields = array()])
 $html selectMultiple (string $key, array $optionValues, [array|string $defaultValues = false], [array $miscFields = array()])
 void submit (string $name, string $value, [array $fields = array()], [ $additionalClasses = ''])
 $html telephone (string $key, [string|array $valueOrArray = false], [array $miscFields = array()])
 $html text (string $key, [string|array $valueOrArray = false], [array $miscFields = array()])
 string textarea (string $key)
 $html url (string $key, [string|array $valueOrArray = false], [array $miscFields = array()])
Methods
Constructor __construct (line 26)
  • access: public
FormHelper __construct ()
action (line 35)

Returns an action suitable for including in a form action property.

  • access: public
void action (string $action, [string $task = null])
  • string $action
  • string $task
button (line 57)

Creates a button

  • access: public
void button (string $name, string $value, [array $fields = array()], [ $additionalClasses = ''])
  • string $name
  • array $fields: Additional fields appended at the end of the submit button return string $html
  • string $value: value
  • $additionalClasses
checkbox (line 102)

Creates an HTML checkbox

  • access: public
string checkbox (string $field, string $value, [ $isChecked = false], [ $miscFields = array()], bool $checked)
  • string $field
  • string $value
  • bool $checked
  • $isChecked
  • $miscFields
email (line 265)

Renders an email input field.

  • access: public
$html email (string $key, [string|array $valueOrArray = false], [array $miscFields = array()])
  • string $key: Input element's name and id
  • string|array $valueOrArray: Either the default value (subject to be overridden by $_REQUEST) or $miscFields (see below)
  • array $miscFields: A hash array with html attributes as key/value pairs (possibly including "class")
file (line 76)

Creates a file input element

  • access: public
void file (string $key)
  • string $key
getRequestValue (line 212)
  • access: public
void getRequestValue ( $key)
  • $key
hidden (line 86)

Creates a hidden form field.

  • access: public
void hidden (string $key, [string $value = null])
  • string $key
  • string $value
inputType (line 231)

Internal function that creates an <input> element of type $type. Handles the messiness of evaluating $valueOrArray. Assigns a default class of ccm-input-$type

  • access: protected
$html inputType (string $key, string $type, string|array $valueOrArray, array $miscFields)
  • string $key: Input element's name and id
  • string $type: Accepted value for HTML attribute "type"
  • string|array $valueOrArray: Either the default value (subject to be overridden by $_REQUEST) or $miscFields (see below)
  • array $miscFields: A hash array with html attributes as key/value pairs (possibly including "class")
label (line 67)

Creates a label tag

  • access: public
string label (string $field, string $name)
  • string $field
  • string $name
parseMiscFields (line 388)

Create an HTML fragment of attribute values, merging any CSS class names as necessary

  • return: a fragment of attributes suitable to put inside of an HTML tag
  • access: protected
string parseMiscFields (string $defaultClass, array $attributes)
  • string $defaultClass: Default CSS class name
  • array $attributes: A hash array of attributes (name => value)
password (line 378)

Renders a password input field.

  • access: public
$html password (string $key, [string|array $valueOrArray = false], [array $miscFields = array()])
  • string $key: Input element's name and id
  • string|array $valueOrArray: Either the default value (subject to be overridden by $_REQUEST) or $miscFields (see below)
  • array $miscFields: A hash array with html attributes as key/value pairs (possibly including "class")
processRequestValue (line 180)
  • access: protected
void processRequestValue ( $key, [ $type = "post"])
  • $key
  • $type
radio (line 161)

Generates a radio button

  • access: public
void radio (string $key,  $value, [ $valueOrArray = false], [ $miscFields = array()], string $valueOfButton, string $valueOfSelectedOption)
  • string $key
  • string $valueOfButton
  • string $valueOfSelectedOption
  • $value
  • $valueOrArray
  • $miscFields
search (line 298)

Renders a search input field.

  • access: public
$html search (string $key, [string|array $valueOrArray = false], [array $miscFields = array()])
  • string $key: Input element's name and id
  • string|array $valueOrArray: Either the default value (subject to be overridden by $_REQUEST) or $miscFields (see below)
  • array $miscFields: A hash array with html attributes as key/value pairs (possibly including "class")
select (line 307)

Renders a select field. First argument is the name of the field. Second is an associative array of key => display. Second argument is either the value of the field to be selected (and if it's blank we check post) or a misc. array of fields

  • access: public
$html select (string $key,  $optionValues, [ $valueOrArray = false], [ $miscFields = array()])
  • string $key
  • $optionValues
  • $valueOrArray
  • $miscFields
selectMultiple (line 351)

Renders a multiple select box

  • access: public
$html selectMultiple (string $key, array $optionValues, [array|string $defaultValues = false], [array $miscFields = array()])
  • string $key: Select's name and id
  • array $optionValues: Hash array with name/value as the select's option value/text
  • array|string $defaultValues: Default value(s) which match with the option values; overridden by $_REQUEST
  • array $miscFields: A hash array with html attributes as key/value pairs (possibly including "class")
submit (line 46)

Creates a submit button

  • access: public
void submit (string $name, string $value, [array $fields = array()], [ $additionalClasses = ''])
  • string $name
  • array $fields: Additional fields appended at the end of the submit button return string $html
  • string $value: value
  • $additionalClasses
telephone (line 276)

Renders a telephone input field.

  • access: public
$html telephone (string $key, [string|array $valueOrArray = false], [array $miscFields = array()])
  • string $key: Input element's name and id
  • string|array $valueOrArray: Either the default value (subject to be overridden by $_REQUEST) or $miscFields (see below)
  • array $miscFields: A hash array with html attributes as key/value pairs (possibly including "class")
text (line 253)

Renders a text input field.

  • access: public
$html text (string $key, [string|array $valueOrArray = false], [array $miscFields = array()])
  • string $key: Input element's name and id
  • string|array $valueOrArray: Either the default value (subject to be overridden by $_REQUEST) or $miscFields (see below)
  • array $miscFields: A hash array with html attributes as key/value pairs (possibly including "class")
textarea (line 131)

Creates a textarea field. Second argument is either the value of the field (and if it's blank we check post) or a misc. array of fields

  • access: public
string textarea (string $key)
  • string $key
url (line 287)

Renders a URL input field.

  • access: public
$html url (string $key, [string|array $valueOrArray = false], [array $miscFields = array()])
  • string $key: Input element's name and id
  • string|array $valueOrArray: Either the default value (subject to be overridden by $_REQUEST) or $miscFields (see below)
  • array $miscFields: A hash array with html attributes as key/value pairs (possibly including "class")

Documentation generated on Thu, 15 Sep 2011 16:36:26 -0700 by phpDocumentor 1.4.1