[ Index ]
 

Code source de PHPonTrax 2.6.6-svn

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/vendor/trax/action_view/helpers/ -> form_helper.php (sommaire)

File containing the FormHelper class (PHP 5)

Copyright: (c) 2005 John Peterson
Version: $Id: form_helper.php 243 2006-08-23 05:25:24Z john $
Poids: 422 lignes (16 kb)
Inclus ou requis: 1 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 1 class

FormHelper:: (19 méthodes):
  __construct()
  tag_name()
  tag_name_with_index()
  tag_id()
  tag_id_with_index()
  add_default_name_and_id()
  to_input_field_tag()
  to_radio_button_tag()
  to_text_area_tag()
  to_check_box_tag()
  to_boolean_select_tag()
  text_field()
  password_field()
  hidden_field()
  file_field()
  text_area()
  check_box()
  radio_button()
  boolean_select()


Classe: FormHelper  - X-Ref


__construct($object_name, $attribute_name)   X-Ref


tag_name()   X-Ref


tag_name_with_index($index)   X-Ref


tag_id()   X-Ref


tag_id_with_index($index)   X-Ref


add_default_name_and_id($options)   X-Ref

param: string[]

to_input_field_tag($field_type, $options = array()   X-Ref
Generate an HTML or XML input tag with optional attributes

param: string  Type of input field (<samp>'text'</samp>,
param: string[] Attributes to apply to the input tag:<br>
return: string

to_radio_button_tag($tag_value, $options = array()   X-Ref


to_text_area_tag($options = array()   X-Ref


to_check_box_tag($options = array()   X-Ref


to_boolean_select_tag($options = array()   X-Ref


text_field($object, $field, $options = array()   X-Ref
Generate HTML/XML for <input type="text" /> in a view file

Example: In the view file, code
<code><?= text_field("Person", "fname"); ?></code>
Result: <input id="Person_fname" name="Person[fname]" size="30" type="text" value="$Person->fname" />
param: string  Class name of the object being processed
param: string  Name of attribute in the object being processed
param: string[]  Attributes to apply to the generated input tag as:<br>

password_field($object, $field, $options = array()   X-Ref
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" />


hidden_field($object, $field, $options = array()   X-Ref
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" />


file_field($object, $field, $options = array()   X-Ref
Works just like text_field, but returns a input tag of the "file" type instead, which won't have any default value.


text_area($object, $field, $options = array()   X-Ref
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>


check_box($object, $field, $options = array()   X-Ref
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" />


radio_button($object, $field, $tag_value, $options = array()   X-Ref
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" />


boolean_select($object, $field, $options = array()   X-Ref
Make a new FormHelper object and call its to_boolean_select_tag method




Généré le : Sun Feb 25 20:04:38 2007 par Balluche grâce à PHPXref 0.7