helpers/form – Kohana API 2.3 Documentation

system/helpers/form.php

Class: form_Core

class form_Core

Form helper class.


Methods

form_Core :: open

public static function open

Generates an opening HTML form tag.

Parameters:

string action
(NULL) form action attribute
array attr
(array) extra attributes
array hidden
(NULL) hidden fields to be created immediately after the form tag

Return: string


form_Core :: open_multipart

public static function open_multipart

Generates an opening HTML form tag that can be used for uploading files.

Parameters:

string action
(NULL) form action attribute
array attr
(array) extra attributes
array hidden
(array) hidden fields to be created immediately after the form tag

Return: string


form_Core :: open_fieldset

public static function open_fieldset

Generates a fieldset opening tag.

Parameters:

array data
(NULL) html attributes
string extra
(string ) a string to be attached to the end of the attributes

Return: string


form_Core :: close_fieldset

public static function close_fieldset

Generates a fieldset closing tag.

Return: string


form_Core :: legend

public static function legend

Generates a legend tag for use with a fieldset.

Parameters:

string text
(string ) legend text
array data
(NULL) HTML attributes
string extra
(string ) a string to be attached to the end of the attributes

Return: string


form_Core :: hidden

public static function hidden

Generates hidden form fields. You can pass a simple key/value string or an associative array with multiple values.

Parameters:

string or array data
input name (string) or key/value pairs (array)
string value
(string ) input value, if using an input name

Return: string


form_Core :: input

public static function input

Creates an HTML form input tag. Defaults to a text type.

Parameters:

string or array data
input name or an array of HTML attributes
string value
(string ) input value, when using a name
string extra
(string ) a string to be attached to the end of the attributes

Return: string


form_Core :: password

public static function password

Creates a HTML form password input tag.

Parameters:

string or array data
input name or an array of HTML attributes
string value
(string ) input value, when using a name
string extra
(string ) a string to be attached to the end of the attributes

Return: string


form_Core :: upload

public static function upload

Creates an HTML form upload input tag.

Parameters:

string or array data
input name or an array of HTML attributes
string value
(string ) input value, when using a name
string extra
(string ) a string to be attached to the end of the attributes

Return: string


form_Core :: textarea

public static function textarea

Creates an HTML form textarea tag.

Parameters:

string or array data
input name or an array of HTML attributes
string value
(string ) input value, when using a name
string extra
(string ) a string to be attached to the end of the attributes

Return: string


form_Core :: dropdown

public static function dropdown

Creates an HTML form select tag, or "dropdown menu".

Parameters:

string or array data
input name or an array of HTML attributes
array options
(NULL) select options, when using a name
string selected
(NULL) option key that should be selected by default
string extra
(string ) a string to be attached to the end of the attributes

Return: string


form_Core :: checkbox

public static function checkbox

Creates an HTML form checkbox input tag.

Parameters:

string or array data
input name or an array of HTML attributes
string value
(string ) input value, when using a name
boolean checked
(FALSE) make the checkbox checked by default
string extra
(string ) a string to be attached to the end of the attributes

Return: string


form_Core :: radio

public static function radio

Creates an HTML form radio input tag.

Parameters:

string or array data
(string ) input name or an array of HTML attributes
string value
(string ) input value, when using a name
boolean checked
(FALSE) make the radio selected by default
string extra
(string ) a string to be attached to the end of the attributes

Return: string


form_Core :: submit

public static function submit

Creates an HTML form submit input tag.

Parameters:

string or array data
(string ) input name or an array of HTML attributes
string value
(string ) input value, when using a name
string extra
(string ) a string to be attached to the end of the attributes

Return: string


form_Core :: button

public static function button

Creates an HTML form button input tag.

Parameters:

string or array data
(string ) input name or an array of HTML attributes
string value
(string ) input value, when using a name
string extra
(string ) a string to be attached to the end of the attributes

Return: string


form_Core :: close

public static function close

Closes an open form tag.

Parameters:

string extra
(string ) string to be attached after the closing tag

Return: string


form_Core :: label

public static function label

Creates an HTML form label tag.

Parameters:

string or array data
(string ) label "for" name or an array of HTML attributes
string text
(string ) label text or HTML
string extra
(string ) a string to be attached to the end of the attributes

Return: string


form_Core :: attributes

public static function attributes

Sorts a key/value array of HTML attributes, putting form attributes first, and returns an attribute string.

Parameters:

array attr
HTML attributes array
type
(NULL)

Return: string