FreenetIS
 All Classes Namespaces Functions Variables Pages
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Form_Input Class Reference
Inheritance diagram for Form_Input:
Form_Checkbox Form_Checklist Form_Date Form_Dateselect Form_Dropdown Form_Hidden Form_Html_textarea Form_Password Form_Radio Form_Submit Form_Textarea Form_Upload

Public Member Functions

 __construct ($name)
 Sets the input element name.
 __call ($method, $args)
 Sets form attributes, or return rules.
 __get ($key)
 Returns form attributes.
 matches ($input)
 Sets a form element that this element must match the value of.
 callback ($callback)
 Sets a callback method as a rule for this input.
 name ($val=NULL)
 Sets name.
 label ($val=NULL)
 Sets or returns the input label.
 help ($val=NULL)
 Sets help.
 script ($type, $val=NULL)
 Sets script.
 message ($val=NULL)
 Set or return the error message.
 html ()
 Runs validation and returns the element HTML.
 add_error ($key, $val)
 Add an error to the input.
 error_messages ($func=NULL, $message=NULL)
 Set or return the error messages.
 validate ()
 Validate this input based on the set rules.

Public Attributes

 $method

Protected Member Functions

 html_element ()
 Returns the form input HTML.
 add_rules (array $rules, $action)
 Replace, remove, or append rules.
 input_value ()
 Get the global input value.
 load_value ()
 Load the value of the input, if form data is present.
 rule_gps ()
 Check if value is GPS coordinate if it is not empty.
 rule_preg_regex ()
 Check if value is pregex if it is not empty.
 rule_required ()
 Validate required.
 rule_required_with_zero ()
 Validate required that works for zero number.
 rule_length ($min, $max=NULL)
 Validate length.

Protected Attributes

 $data
 $protect = array()
 $rules = array()
 $matches = array()
 $callbacks = array()
 $is_valid
 $errors = array()
 $error_messages = array()

Member Function Documentation

Form_Input::__call (   $method,
  $args 
)

Sets form attributes, or return rules.

Returns
Form_Input

Reimplemented in Form_Dateselect, and Form_Date.

Form_Input::__get (   $key)

Returns form attributes.

Parameters
stringattribute name
Returns
string

Reimplemented in Form_Checkbox, Form_Checklist, Form_Dropdown, and Form_Radio.

Form_Input::add_error (   $key,
  $val 
)

Add an error to the input.

Returns
object
Form_Input::add_rules ( array  $rules,
  $action 
)
protected

Replace, remove, or append rules.

Parameters
arrayrules to change
stringaction to use: replace, remove, append
Form_Input::callback (   $callback)

Sets a callback method as a rule for this input.

Parameters
callback
Returns
Form_Input
Form_Input::error_messages (   $func = NULL,
  $message = NULL 
)

Set or return the error messages.

Parameters
string|arrayfailed validation function, or an array of messages
stringerror message
Returns
object|array
Form_Input::help (   $val = NULL)

Sets help.

Parameters
string$val
Returns
Form_Input
Form_Input::html ( )

Runs validation and returns the element HTML.

Returns
string

Reimplemented in Form_Dropdown, Form_Checklist, Form_Hidden, and Form_Submit.

Form_Input::html_element ( )
protected

Returns the form input HTML.

Returns
string

Reimplemented in Form_Upload, Form_Dateselect, Form_Date, Form_Html_textarea, Form_Checkbox, Form_Dropdown, Form_Radio, and Form_Textarea.

Form_Input::input_value ( )
protected

Get the global input value.

Returns
string|bool
Form_Input::label (   $val = NULL)

Sets or returns the input label.

Parameters
stringlabel to set
Returns
Form_Input
Form_Input::load_value ( )
protected

Load the value of the input, if form data is present.

Returns
void

Reimplemented in Form_Date, Form_Dateselect, Form_Radio, Form_Dropdown, Form_Checklist, Form_Checkbox, and Form_Hidden.

Form_Input::matches (   $input)

Sets a form element that this element must match the value of.

Parameters
objectanother Forge input
Returns
Form_Input
Form_Input::message (   $val = NULL)

Set or return the error message.

Parameters
stringerror message
Returns
Form_Input
Form_Input::name (   $val = NULL)

Sets name.

Parameters
mixed$val
Returns
Form_Input
Form_Input::rule_gps ( )
protected

Check if value is GPS coordinate if it is not empty.

Author
Ondřej Fibich
Form_Input::rule_preg_regex ( )
protected

Check if value is pregex if it is not empty.

Author
Ondřej Fibich
Form_Input::script (   $type,
  $val = NULL 
)

Sets script.

Parameters
string$type
string$val
Returns
Form_Input
Form_Input::validate ( )

Validate this input based on the set rules.

Returns
bool

Reimplemented in Form_Upload, and Form_Submit.

Member Data Documentation

Form_Input::$data
protected
Initial value:
array
(
'type' => 'text',
'class' => 'textbox',
'value' => ''
)

The documentation for this class was generated from the following file: