Docs For Class Validation

## Validation

Description

Rules used for validation of form fields.

Located in /Validation.php (line 17)

Method Summary
Validation Validation (string $func_name)
void AddRule (string $fieldname, string $error_message, string $function_name)
boolean not_empty (string $field_string)
boolean positive_dollars (string $field_string)
boolean positive_integer (string $field_string)
string RenderJavascript ([string $prefix = ""], string $onsubmit)
boolean selected ( $field_string, string $select_string)
boolean Validate (object $object)
boolean valid_date_format (string $field_string)
boolean valid_email_format (string $field_string)
Methods
Constructor Validation (line 40)

Initialise a new validation.

Validation Validation (string $func_name)

- string $func_name: The javascript function name to call onsubmit of the form

AddRule (line 53)

Adds a validation rule for a specific field upon submission of the form.

You must call RenderRules below RenderFields when outputing the page

void AddRule (string $fieldname, string $error_message, string $function_name)

- string $fieldname: The name of the field.
- string $error_message: The message to display on unsuccessful validation.
- string $function_name: The function to call to validate the field

not_empty (line 129)

Checks if a string is empty

- return: True if the string is not empty.

boolean not_empty (string $field_string)

- string $field_string: The field value that is being checked.

positive_dollars (line 150)

Check that the given string is a positive dollar amount.

Use not_empty first if string is required.

- return: Returns true if the given string is a positive dollar amount.

boolean positive_dollars (string $field_string)

- string $field_string: The amount to be checked.

positive_integer (line 167)

Check that the given string is a positive integer.

Use not_empty first if string is required.

- return: Returns true if the given string is a positive integer.

boolean positive_integer (string $field_string)

- string $field_string: The amount to be checked.

RenderJavascript (line 64)

Returns the javascript for form validation using the rules.

- return: HTML/Javascript for form validation.

string RenderJavascript ([string $prefix = ""], string $onsubmit)

- string $onsubmit: The name of the function called on submission of the form.
- string $prefix: Optional prefix for form fields.

selected (line 139)

Checks that a string is not empty or zero

- return: True if the string is not empty or equal to 0.

boolean selected ( $field_string, string $select_string)

- string $select_string: The select value that is being checked.
- $field_string

Validate (line 99)

Validates the form according to it's rules.

- return: True if the validation succeeded.

boolean Validate (object $object)

- object $object: The data object that requires form validation.

valid_date_format (line 193)

Check that the given string matches the user's date format.

Use not_empty first if string is required.

- return: Returns true if the given string matches the user's date format from session.

boolean valid_date_format (string $field_string)

- string $field_string: The string to be checked.

valid_email_format (line 179)

Check that the given string is a valid email address.

Use not_empty first if string is required.

- return: Returns true if the given string is a valid email address.

boolean valid_email_format (string $field_string)

- string $field_string: The string to be checked.

Documentation generated on Fri, 13 Jan 2012 23:40:18 +1300 by phpDocumentor 1.4.3