Procedural File: form_helper.php
Source Location: /vendor/trax/action_view/helpers/form_helper.php
Page Details:
File containing the FormHelper class
(PHP 5)
Tags:
boolean_select [line 419]
void boolean_select(
mixed $object, mixed $field, [mixed $options = array()])
|
|
Make a new FormHelper object and call its to_boolean_select_tag method
Tags:
check_box [line 392]
void check_box(
mixed $object, mixed $field, [mixed $options = array()], [mixed $checked_value = "1"], [mixed $unchecked_value = "0"])
|
|
Returns a checkbox tag tailored for accessing a specified attribute (identified by $field) on an object assigned to the template (identified by $object). It's intended that $field returns an integer and if that integer is above zero, then the checkbox is checked. Additional $options on the input tag can be passed as an array with $options. The $checked_value defaults to 1 while the default $unchecked_value is set to 0 which is convenient for boolean values. Usually unchecked checkboxes don't post anything. We work around this problem by adding a hidden value with the same name as the checkbox. Example: Imagine that $post->validated is 1: check_box("post", "validated"); Result: <input type="checkbox" id="post_validate" name="post[validated] value="1" checked="checked" /> <input name="post[validated]" type="hidden" value="0" /> Example: Imagine that $puppy->gooddog is no: check_box("puppy", "gooddog", array(), "yes", "no"); Result: <input type="checkbox" id="puppy_gooddog" name="puppy[gooddog] value="yes" /> <input name="puppy[gooddog]" type="hidden" value="no" />
Tags:
file_field [line 356]
void file_field(
mixed $object, mixed $field, [mixed $options = array()])
|
|
Works just like text_field, but returns a input tag of the "file" type instead, which won't have any default value.
Tags:
hidden_field [line 347]
void hidden_field(
mixed $object, mixed $field, [mixed $options = array()])
|
|
Works just like text_field, but returns a input tag of the "hidden" type instead. Example: hidden_field("post", "title"); Result: <input type="hidden" id="post_title" name="post[title]" value="$post->title" />
Tags:
password_field [line 336]
void password_field(
mixed $object, mixed $field, [mixed $options = array()])
|
|
Works just like text_field, but returns a input tag of the "password" type instead. Example: password_field("user", "password"); Result: <input type="password" id="user_password" name="user[password]" value="$user->password" />
Tags:
radio_button [line 410]
void radio_button(
mixed $object, mixed $field, mixed $tag_value, [mixed $options = array()])
|
|
Returns a radio button tag for accessing a specified attribute (identified by $field) on an object assigned to the template (identified by $object). If the current value of $field is $tag_value the radio button will be checked. Additional $options on the input tag can be passed as a hash with $options. Example: Imagine that $post->category is "trax": radio_button("post", "category", "trax"); radio_button("post", "category", "java"); Result: <input type="radio" id="post_category" name="post[category] value="trax" checked="checked" /> <input type="radio" id="post_category" name="post[category] value="java" />
Tags:
text_area [line 366]
void text_area(
mixed $object, mixed $field, [mixed $options = array()])
|
|
Example: text_area("post", "body", array("cols" => 20, "rows" => 40)); Result: <textarea cols="20" rows="40" id="post_body" name="post[body]">$post->body</textarea>
Tags:
text_field [line 325]
void text_field(
string $object, string $field, [string[] $options = array()])
|
|
Generate HTML/XML for <input type="text" /> in a view file Example: In the view file, code Result: <input id="Person_fname" name="Person[fname]" size="30" type="text" value="$Person->fname" />
Tags:
Parameters
string |
$object |
Class name of the object being processed |
string |
$field |
Name of attribute in the object being processed |
string[] |
$options |
Attributes to apply to the generated input tag as: array('attr1' => 'value1'[, 'attr2' => 'value2']...) |
|
|