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

Class: FormOptionsHelper

Source Location: /vendor/trax/action_view/helpers/form_options_helper.php

Class Overview

Helpers
   |
   --FormHelper
      |
      --FormOptionsHelper



Author(s):

Methods


Inherited Variables

Inherited Methods

Class: FormHelper

FormHelper::__construct()
FormHelper::add_default_name_and_id()
FormHelper::error_wrapping()
If this tag has an error, wrap it with a visual indicator
FormHelper::tag_id()
FormHelper::tag_id_with_index()
FormHelper::tag_name()
FormHelper::tag_name_with_index()
FormHelper::to_boolean_select_tag()
FormHelper::to_check_box_tag()
FormHelper::to_input_field_tag()
Generate an HTML or XML input tag with optional attributes
FormHelper::to_radio_button_tag()
FormHelper::to_text_area_tag()

Class: Helpers

Helpers::__construct()
Construct a Helpers object
Helpers::boolean_attribute()
Convert an attribute to proper XML boolean form
Helpers::cdata_section()
Wrap CDATA begin and end tags around argument
Helpers::content_tag()
Generate an open/close pair of tags with optional attributes and content between
Helpers::convert_options()
Convert selected attributes to proper XML boolean form
Helpers::object()
Given the name of an ActiveRecord subclass, find an instance
Helpers::tag()
Generate an HTML or XML tag with optional attributes and self-ending
Helpers::tag_options()
Convert array of tag attribute names and values to string
Helpers::to_content_tag()
Helpers::value()
Get value of current attribute in the current ActiveRecord object

Class Details

[line 85]


Tags:

todo:  Document this class


[ Top ]


Class Methods


method add_options [line 268]

void add_options( string $option_tags, string[] $options, [string $value = null])



Tags:

usedby:  FormOptionsHelper::to_collection_select_tag()
usedby:  FormOptionsHelper::to_country_select_tag()
usedby:  FormOptionsHelper::to_select_tag()
access:  private
todo:  Document this method
uses:  Helpers::value()
todo:  FIXME: Why the third argument? It's overwritten!


Parameters:

string   $option_tags  
string[]   $options  
string   $value  

[ Top ]

method country_options_for_select [line 175]

void country_options_for_select( [integer $selected = null], [mixed $priority_countries = array()])

Generate HTML options for world countries



Tags:

todo:  FIXME: Second argument doesn't work


Parameters:

integer   $selected   Array key of country initially selected NOTE: Only the option tags are returned, you have to wrap this call in a regular HTML select tag.

[ Top ]

method options_for_select [line 108]

string options_for_select( string[] $choices, [integer $selected = null])

Generate HTML option tags from a list of choices

Accepts an array of possible choices and returns a string of option tags. The value of each array element becomes the visible text of an option, and the key of the element becomes the value returned to the server. For example:
options_for_select(array('foo','bar'));
will return:
<option value="0">foo</option>\n
<option value="1">bar</option>

The optional second argument specifies the array key of an option to be initially selected.

NOTE: Only the option tags are returned, you have to wrap this call in a regular HTML select tag.




Tags:



Parameters:

string[]   $choices   Choices
integer   $selected   Selected choice

[ Top ]

method options_from_collection_for_select [line 152]

void options_from_collection_for_select( mixed $collection, mixed $attribute_value, mixed $attribute_text, [mixed $selected_value = null])

Returns a string of option tags that have been compiled by

iterating over the +collection+ and assigning the result of a call to the +value_method+ as the option value and the +text_method+ as the option text. If +selected_value+ is specified, the element returning a match on +value_method+ will get the selected option tag.

Example (call, result). Imagine a loop iterating over each +person+ in <tt>@project.people</tt> to generate an input tag: options_from_collection_for_select(@project.people, "id", "name") <option value="#{person.id}">#{person.name}</option>

NOTE: Only the option tags are returned, you have to wrap this call in a regular HTML select tag.




Tags:

usedby:  FormOptionsHelper::to_collection_select_tag()
todo:  Document this method


[ Top ]

method to_collection_select_tag [line 222]

void to_collection_select_tag( mixed $collection, mixed $attribute_value, mixed $attribute_text, mixed $options, mixed $html_options)



Tags:



[ Top ]

method to_country_select_tag [line 246]

void to_country_select_tag( mixed $priority_countries, mixed $options, mixed $html_options)



Tags:



[ Top ]

method to_select_tag [line 202]

void to_select_tag( mixed $choices, mixed $options, mixed $html_options)



Tags:



[ Top ]


Documentation generated on Thu, 04 May 2006 19:47:42 -0600 by phpDocumentor 1.3.0RC4