Form Class

Helper for creating forms with support for creating dynamic form objects.

package Fuel
category Core

 Methods

When autoloaded this will method will be fired, load once and once only

_init() : void

Create a button

button(string | array $field, string $value, array $attributes) : string

Parameters

$field

stringarray

either fieldname or full attributes array (when array other params are ignored)

$value

string

$attributes

array

Returns

string

Create a checkbox

checkbox(string | array $field, string $value, mixed $checked, array $attributes) : string

Parameters

$field

stringarray

either fieldname or full attributes array (when array other params are ignored)

$value

string

$checked

mixed

either attributes (array) or bool/string to set checked status

$attributes

array

Returns

string

Create a form close tag

close() : string

Returns

string

Create a CSRF hidden field

csrf() : string

Returns

string

Create a fieldset close tag

fieldset_close() : string

Returns

string

Create a fieldset open tag

fieldset_open(array $attributes, string $legend) : string

Parameters

$attributes

array

array with tag attribute settings

$legend

string

string for the fieldset legend

Returns

string

Create a file upload input field

file(string | array $field, array $attributes) : string

Parameters

$field

stringarray

either fieldname or full attributes array (when array other params are ignored)

$attributes

array

Returns

string

forge()

forge($fieldset, array $config) 

Parameters

$fieldset

$config

Create a form input

input(string | array $field, string $value, array $attributes) : string

Parameters

$field

stringarray

either fieldname or full attributes array (when array other params are ignored)

$value

string

$attributes

array

Returns

string

Returns the 'default' instance of Form

instance(null | string $name) : \Fuel\Core\Form_Instance

Parameters

$name

nullstring

Returns

Create a label field

label(string | array $label, string $id, array $attributes) : string

Parameters

$label

stringarray

either fieldname or full attributes array (when array other params are ignored)

$id

string

$attributes

array

Returns

string

Create a form open tag

open(string | array $attributes, array $hidden) : string

Parameters

$attributes

stringarray

action string or array with more tag attribute settings

$hidden

array

Returns

string

Create a password input field

password(string | array $field, string $value, array $attributes) : string

Parameters

$field

stringarray

either fieldname or full attributes array (when array other params are ignored)

$value

string

$attributes

array

Returns

string

Prep Value

prep_value(string $value) : string

Prepares the value for display in the form

Parameters

$value

string

Returns

string

Create a radio button

radio(string | array $field, string $value, mixed $checked, array $attributes) : string

Parameters

$field

stringarray

either fieldname or full attributes array (when array other params are ignored)

$value

string

$checked

mixed

either attributes (array) or bool/string to set checked status

$attributes

array

Returns

string

Create a reset button

reset(string | array $field, string $value, array $attributes) : string

Parameters

$field

stringarray

either fieldname or full attributes array (when array other params are ignored)

$value

string

$attributes

array

Returns

string

Select

select(string | array $field, string $values, array $options, array $attributes) : string

Generates a html select element based on the given parameters

Parameters

$field

stringarray

either fieldname or full attributes array (when array other params are ignored)

$values

string

selected value(s)

$options

array

array of options and option groups

$attributes

array

Returns

string

Create a submit button

submit(string | array $field, string $value, array $attributes) : string

Parameters

$field

stringarray

either fieldname or full attributes array (when array other params are ignored)

$value

string

$attributes

array

Returns

string

Create a textarea field

textarea(string | array $field, string $value, array $attributes) : string

Parameters

$field

stringarray

either fieldname or full attributes array (when array other params are ignored)

$value

string

$attributes

array

Returns

string

Attr to String

attr_to_string(array $attr) : string

Wraps the global attributes function and does some form specific work

Parameters

$attr

array

Returns

string

 Properties

 

$instance

$instance