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

Class: HTML_QuickForm_altselect

Source Location: /HTML_QuickForm_altselect-1.1.1/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: @package_version@

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 124]

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 ]

$includeOtherType =  'text'

[line 91]

Other text type: 'text' or 'textarea'

Type:   string


[ Top ]

$list_type =

[line 134]

Rather than render with a delimiter you may choose to render as a HTML list.

Type:   string


[ Top ]

$otherLabel =  'Other'

[line 99]

Label for the Other option.
  • Access: public

Type:   string


[ Top ]

$otherText =  'If other please specify:'

[line 107]

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

Type:   string


[ Top ]

$otherTextMultiple =  'Other:'

[line 115]

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

Type:   string


[ Top ]



Method Detail

HTML_QuickForm_altselect (Constructor)   [line 175]

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, "_qf_other_text" for the text field and "_qf_all" to apply the attributes to all the option elements.

[ Top ]

accept   [line 682]

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 473]

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 748]

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 216]

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 622]

void setDelimiter( string $delimiter)

Set the delimiter.
  • Access: public

Parameters:

string   $delimiter   —  delimiter to use between the subelements

[ Top ]

setGroup   [line 658]

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 601]

void setIncludeOther( [bool/string $include = true])

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

Parameters:

bool/string   $include   —  If bool: whether to include the other text field, else if string: either 'text' or 'textarea'

[ Top ]

setListType   [line 642]

void setListType( string $list_type)

Set the options to render as an ordered/unordered list
  • Access: public

Parameters:

string   $list_type   —  The list type

[ Top ]

setSelected   [line 542]

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 197]

string toHtml( )

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

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:41:30 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.