HTML_QuickForm_altselect
[ class tree: HTML_QuickForm_altselect ] [ index: HTML_QuickForm_altselect ] [ all elements ]

Class: HTML_QuickForm_altselect

Source Location: /HTML_QuickForm_altselect-1.0.0RC1/altselect.php

Class Overview

HTML_QuickForm_select
   |
   --HTML_QuickForm_altselect

HTML QuickForm Alternate Select


Author(s):

  • David Sanders (shang.xiao.sanders at gmail.com)

Version:

  • Release: 1.0.0RC1

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 72]
HTML QuickForm Alternate Select

HTML_QuickForm plugin that changes a select into a group of radio buttons or checkboxes with an optional textbox for other options not listed. If the select element is listed as multiple, then it will be rendered with checkboxes, otherwise it is rendered with radio buttons.



[ Top ]


Class Variables

$delimiter =  '<br />'

[line 115]

Delimiter between subelements. Use br to go vertical, or nbsp to go horizontal.
  • Access: public

Type:   string


[ Top ]

$includeOther =  false

[line 82]

Include the other text field for non-listed entry.
  • Access: public

Type:   bool


[ Top ]

$otherLabel =  'Other'

[line 90]

Label for the Other option.
  • Access: public

Type:   string


[ Top ]

$otherText =  'If other please specify:'

[line 98]

Text label to go in front of other text field (singular mode).
  • Access: public

Type:   string


[ Top ]

$otherTextMultiple =  'Other:'

[line 106]

Text label to go in front of other text field (multiple mode).
  • Access: public

Type:   string


[ Top ]



Method Detail

HTML_QuickForm_altselect (Constructor)   [line 155]

void HTML_QuickForm_altselect( [string $elementName = null], [mixed $elementLabel = null], [mixed $options = null], [mixed $attributes = null])

Constructor. Used to distinguish the attributes array which should be an associative array of options to either a typical HTML attribute string or another associative array

Parameters:

string   $elementName   —  select name attribute
mixed   $elementLabel   —  label(s) for the select
mixed   $options   —  data to be used to populate options
mixed   $attributes   —  an associative array of option value -> attributes. Each attribute is either a typical HTML attribute string or an associative array. NOTE: use "_qf_other" for the other radio button, and "_qf_other_text" for the text field.

[ Top ]

accept   [line 611]

void accept( &$renderer, [ $required = false], [string $error = null], HTML_QuickForm_Renderer $renderer, bool $require)

Accepts a renderer. Overload select in case we'd like to see the checkboxes/radio buttons in a group when renderering with another renderer.

This function was copied from HTML_QuickForm_group::accept() and modified for use with this class.

  • See: HTML_QuickForm_group::accept()
  • Access: public

Parameters:

HTML_QuickForm_Renderer   $renderer   —  the QF renderer
bool   $require   —  whether a group is required
string   $error   —  an error message associated with
   &$renderer   — 
   $required   — 

[ Top ]

exportValue   [line 425]

mixed exportValue( &$submitValues, [bool $assoc = false], array $submitValues)

Exports the value.

If the other value is set, this will be exported if in singular mode and the other radio button is selected. Otherwise if in multiple mode the other value is added to the array of values.

  • Return: Single value or array of values
  • Access: public

Parameters:

array   $submitValues   —  submitValues values submitted
bool   $assoc   —  propagate on to HTML_QuickForm_select::exportValue()
   &$submitValues   — 

[ Top ]

getElementName   [line 677]

string getElementName( )

Returns the name of this element. Used by HTML_QuickForm::getSubmitValue() when this element is registered as a group.
  • See: HTML_QuickForm::getSubmitValue()
  • Access: public

[ Top ]

getElements   [line 196]

mixed getElements( [bool $formatArray = true])

Arrange the buttons/boxes and other bits either concatenated as a html string or in an array. When this element is registered as a group, getElements should act in the same way as HTML_QuickForm_group::getElements().

(Therefore the default must be to format as an array)

  • Return: Array or HTML string
  • See: HTML_QuickForm_group::getElements()
  • Access: public

Parameters:

bool   $formatArray   —  set true for an array (default), false for HTML

[ Top ]

setDelimiter   [line 567]

void setDelimiter( string $delimiter)

Set the delimiter.
  • Access: public

Parameters:

string   $delimiter   —  delimiter to use between the subelements

[ Top ]

setGroup   [line 587]

void setGroup( [bool $is_group = true])

Tell this element to act like a group when being accepted.
  • See: HTML_QuickForm_element::_type
  • Access: public

Parameters:

bool   $is_group   —  whether to act like a group or not

[ Top ]

setIncludeOther   [line 552]

void setIncludeOther( [bool $include = true])

Set the select to include the 'other' textfield.
  • Access: public

Parameters:

bool   $include   —  whether to include the other text field

[ Top ]

setSelected   [line 494]

void setSelected( mixed $values)

Set the selected options. If a non-listed option is specified, it will go into the other text field. Note at this point, the other and multiple attributes may not have been set.
  • Access: public

Parameters:

mixed   $values   —  array or comma delimited string of selected values

[ Top ]

toHtml   [line 177]

string toHtml( )

Render the HTML_QuickForm element.
  • Return: The rendered HTML
  • Access: public

[ Top ]


Documentation generated on Mon, 11 Mar 2019 14:56:40 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.