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 | |
| CI_Form_validation::_execute | ( | $ | row, | |
| $ | rules, | |||
| $ | postdata = NULL, |
|||
| $ | cycles = 0 | |||
| ) |
Executes the Validation routines
private
| array | ||
| array | ||
| mixed | ||
| integer |
| CI_Form_validation::_reduce_array | ( | $ | array, | |
| $ | keys, | |||
| $ | i = 0 | |||
| ) |
Traverse a multidimensional $_POST array index until the data is found
private
| array | ||
| array | ||
| integer |
| CI_Form_validation::_reset_post_array | ( | ) |
Re-populate the _POST array with our finalized and processed data
private
| CI_Form_validation::_translate_fieldname | ( | $ | fieldname | ) |
Translate a field name
private
| string | the field name |
| CI_Form_validation::alpha | ( | $ | str | ) |
Alpha
public
| string |
| CI_Form_validation::alpha_dash | ( | $ | str | ) |
Alpha-numeric with underscores and dashes
public
| string |
| CI_Form_validation::alpha_numeric | ( | $ | str | ) |
Alpha-numeric
public
| string |
| CI_Form_validation::CI_Form_validation | ( | $ | rules = array() |
) |
Constructor
| CI_Form_validation::encode_php_tags | ( | $ | str | ) |
Convert PHP tags to entities
public
| string |
| CI_Form_validation::error | ( | $ | field = '', |
|
| $ | prefix = '', |
|||
| $ | suffix = '' | |||
| ) |
Get Error Message
Gets the error message associated with a particular field
public
| string | the field name |
| CI_Form_validation::error_string | ( | $ | prefix = '', |
|
| $ | suffix = '' | |||
| ) |
Error String
Returns the error messages as a string, wrapped in the error delimiters
public
| string | ||
| string |
| CI_Form_validation::exact_length | ( | $ | str, | |
| $ | val | |||
| ) |
Exact Length
public
| string | ||
| value |
| CI_Form_validation::integer | ( | $ | str | ) |
Integer
public
| string |
| CI_Form_validation::is_natural | ( | $ | str | ) |
Is a Natural number (0,1,2,3, etc.)
public
| string |
| CI_Form_validation::is_natural_no_zero | ( | $ | str | ) |
Is a Natural number, but not a zero (1,2,3, etc.)
public
| string |
| CI_Form_validation::is_numeric | ( | $ | str | ) |
Is Numeric
public
| string |
| CI_Form_validation::matches | ( | $ | str, | |
| $ | field | |||
| ) |
Match one field to another
public
| string | ||
| field |
| CI_Form_validation::max_length | ( | $ | str, | |
| $ | val | |||
| ) |
Max Length
public
| string | ||
| value |
| CI_Form_validation::min_length | ( | $ | str, | |
| $ | val | |||
| ) |
Minimum Length
public
| string | ||
| value |
| CI_Form_validation::numeric | ( | $ | str | ) |
Numeric
public
| string |
| 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
| string |
| CI_Form_validation::prep_url | ( | $ | str = '' |
) |
Prep URL
public
| string |
| CI_Form_validation::required | ( | $ | str | ) |
Required
public
| string |
| CI_Form_validation::run | ( | $ | group = '' |
) |
Run the Validator
This function does all the work.
public
| 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
| string | ||
| 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
| string | ||
| string |
| 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
| string | ||
| 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
| string | ||
| 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
| mixed | ||
| string |
| 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
| string | ||
| 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
| string | the field name | |
| string |
| CI_Form_validation::strip_image_tags | ( | $ | str | ) |
Strip Image Tags
public
| 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
| string |
| CI_Form_validation::valid_email | ( | $ | str | ) |
Valid Email
public
| string |
| CI_Form_validation::valid_emails | ( | $ | str | ) |
Valid Emails
public
| string |
| CI_Form_validation::valid_ip | ( | $ | ip | ) |
Validate IP Address
public
| string |
| CI_Form_validation::xss_clean | ( | $ | str | ) |
XSS Clean
public
| string |
| 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 = '' |
1.5.7.1