CI_Form_validation Class Reference

List of all members.

Public Member Functions

 CI_Form_validation ($rules=array())
 set_rules ($field, $label= '', $rules= '')
 set_message ($lang, $val= '')
 set_error_delimiters ($prefix= '< p >', $suffix= '</p >')
 error ($field= '', $prefix= '', $suffix= '')
 error_string ($prefix= '', $suffix= '')
 run ($group= '')
 _reduce_array ($array, $keys, $i=0)
 _reset_post_array ()
 _execute ($row, $rules, $postdata=NULL, $cycles=0)
 _translate_fieldname ($fieldname)
 set_value ($field= '', $default= '')
 set_select ($field= '', $value= '', $default=FALSE)
 set_radio ($field= '', $value= '', $default=FALSE)
 set_checkbox ($field= '', $value= '', $default=FALSE)
 required ($str)
 matches ($str, $field)
 min_length ($str, $val)
 max_length ($str, $val)
 exact_length ($str, $val)
 valid_email ($str)
 valid_emails ($str)
 valid_ip ($ip)
 alpha ($str)
 alpha_numeric ($str)
 alpha_dash ($str)
 numeric ($str)
 is_numeric ($str)
 integer ($str)
 is_natural ($str)
 is_natural_no_zero ($str)
 valid_base64 ($str)
 prep_for_form ($data= '')
 prep_url ($str= '')
 strip_image_tags ($str)
 xss_clean ($str)
 encode_php_tags ($str)

Public Attributes

 $CI
 $_field_data = array()
 $_config_rules = array()
 $_error_array = array()
 $_error_messages = array()
 $_error_prefix = '<p>'
 $_error_suffix = '</p>'
 $error_string = ''
 $_safe_form_data = FALSE


Member Function Documentation

CI_Form_validation::_execute ( row,
rules,
postdata = NULL,
cycles = 0 
)

Executes the Validation routines

private

Parameters:
array 
array 
mixed 
integer 
Returns:
mixed

CI_Form_validation::_reduce_array ( array,
keys,
i = 0 
)

Traverse a multidimensional $_POST array index until the data is found

private

Parameters:
array 
array 
integer 
Returns:
mixed

CI_Form_validation::_reset_post_array (  ) 

Re-populate the _POST array with our finalized and processed data

private

Returns:
null

CI_Form_validation::_translate_fieldname ( fieldname  ) 

Translate a field name

private

Parameters:
string the field name
Returns:
string

CI_Form_validation::alpha ( str  ) 

Alpha

public

Parameters:
string 
Returns:
bool

CI_Form_validation::alpha_dash ( str  ) 

Alpha-numeric with underscores and dashes

public

Parameters:
string 
Returns:
bool

CI_Form_validation::alpha_numeric ( str  ) 

Alpha-numeric

public

Parameters:
string 
Returns:
bool

CI_Form_validation::CI_Form_validation ( rules = array()  ) 

Constructor

CI_Form_validation::encode_php_tags ( str  ) 

Convert PHP tags to entities

public

Parameters:
string 
Returns:
string

CI_Form_validation::error ( field = '',
prefix = '',
suffix = '' 
)

Get Error Message

Gets the error message associated with a particular field

public

Parameters:
string the field name
Returns:
void

CI_Form_validation::error_string ( prefix = '',
suffix = '' 
)

Error String

Returns the error messages as a string, wrapped in the error delimiters

public

Parameters:
string 
string 
Returns:
str

CI_Form_validation::exact_length ( str,
val 
)

Exact Length

public

Parameters:
string 
value 
Returns:
bool

CI_Form_validation::integer ( str  ) 

Integer

public

Parameters:
string 
Returns:
bool

CI_Form_validation::is_natural ( str  ) 

Is a Natural number (0,1,2,3, etc.)

public

Parameters:
string 
Returns:
bool

CI_Form_validation::is_natural_no_zero ( str  ) 

Is a Natural number, but not a zero (1,2,3, etc.)

public

Parameters:
string 
Returns:
bool

CI_Form_validation::is_numeric ( str  ) 

Is Numeric

public

Parameters:
string 
Returns:
bool

CI_Form_validation::matches ( str,
field 
)

Match one field to another

public

Parameters:
string 
field 
Returns:
bool

CI_Form_validation::max_length ( str,
val 
)

Max Length

public

Parameters:
string 
value 
Returns:
bool

CI_Form_validation::min_length ( str,
val 
)

Minimum Length

public

Parameters:
string 
value 
Returns:
bool

CI_Form_validation::numeric ( str  ) 

Numeric

public

Parameters:
string 
Returns:
bool

CI_Form_validation::prep_for_form ( data = ''  ) 

Prep data for form

This function allows HTML to be safely shown in a form. Special characters are converted.

public

Parameters:
string 
Returns:
string

CI_Form_validation::prep_url ( str = ''  ) 

Prep URL

public

Parameters:
string 
Returns:
string

CI_Form_validation::required ( str  ) 

Required

public

Parameters:
string 
Returns:
bool

CI_Form_validation::run ( group = ''  ) 

Run the Validator

This function does all the work.

public

Returns:
bool

CI_Form_validation::set_checkbox ( field = '',
value = '',
default = FALSE 
)

Set Checkbox

Enables checkboxes to be set to the value the user selected in the event of an error

public

Parameters:
string 
string 
Returns:
string

CI_Form_validation::set_error_delimiters ( prefix = '<p>',
suffix = '</p>' 
)

Set The Error Delimiter

Permits a prefix/suffix to be added to each error message

public

Parameters:
string 
string 
Returns:
void

CI_Form_validation::set_message ( lang,
val = '' 
)

Set Error Message

Lets users set their own error messages on the fly. Note: The key name has to match the function name that it corresponds to.

public

Parameters:
string 
string 
Returns:
string

CI_Form_validation::set_radio ( field = '',
value = '',
default = FALSE 
)

Set Radio

Enables radio buttons to be set to the value the user selected in the event of an error

public

Parameters:
string 
string 
Returns:
string

CI_Form_validation::set_rules ( field,
label = '',
rules = '' 
)

Set Rules

This function takes an array of field names and validation rules as input, validates the info, and stores it

public

Parameters:
mixed 
string 
Returns:
void

CI_Form_validation::set_select ( field = '',
value = '',
default = FALSE 
)

Set Select

Enables pull-down lists to be set to the value the user selected in the event of an error

public

Parameters:
string 
string 
Returns:
string

CI_Form_validation::set_value ( field = '',
default = '' 
)

Get the value from a form

Permits you to repopulate a form field with the value it was submitted with, or, if that value doesn't exist, with the default

public

Parameters:
string the field name
string 
Returns:
void

CI_Form_validation::strip_image_tags ( str  ) 

Strip Image Tags

public

Parameters:
string 
Returns:
string

CI_Form_validation::valid_base64 ( str  ) 

Valid Base64

Tests a string for characters outside of the Base64 alphabet as defined by RFC 2045 http://www.faqs.org/rfcs/rfc2045

public

Parameters:
string 
Returns:
bool

CI_Form_validation::valid_email ( str  ) 

Valid Email

public

Parameters:
string 
Returns:
bool

CI_Form_validation::valid_emails ( str  ) 

Valid Emails

public

Parameters:
string 
Returns:
bool

CI_Form_validation::valid_ip ( ip  ) 

Validate IP Address

public

Parameters:
string 
Returns:
string

CI_Form_validation::xss_clean ( str  ) 

XSS Clean

public

Parameters:
string 
Returns:
string


Member Data Documentation

CI_Form_validation::$_config_rules = array()

CI_Form_validation::$_error_array = array()

CI_Form_validation::$_error_messages = array()

CI_Form_validation::$_error_prefix = '<p>'

CI_Form_validation::$_error_suffix = '</p>'

CI_Form_validation::$_field_data = array()

CI_Form_validation::$_safe_form_data = FALSE

CI_Form_validation::$CI

CI_Form_validation::$error_string = ''


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

Generated on Sun Nov 16 16:09:15 2008 for CodeIgniter by  doxygen 1.5.7.1