Initialise a new validation.
Validation
Validation
(string $func_name)
-
string
$func_name: The javascript function name to call onsubmit of the form
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
Checks if a string is empty
boolean
not_empty
(string $field_string)
-
string
$field_string: The field value that is being checked.
Check that the given string is a positive dollar amount.
Use not_empty first if string is required.
boolean
positive_dollars
(string $field_string)
-
string
$field_string: The amount to be checked.
Check that the given string is a positive integer.
Use not_empty first if string is required.
boolean
positive_integer
(string $field_string)
-
string
$field_string: The amount to be checked.
Returns the javascript for form validation using the rules.
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.
Checks that a string is not empty or zero
boolean
selected
( $field_string, string $select_string)
-
string
$select_string: The select value that is being checked.
-
$field_string
Validates the form according to it's rules.
boolean
Validate
(object $object)
-
object
$object: The data object that requires form validation.
Check that the given string matches the user's date format.
Use not_empty first if string is required.
boolean
valid_date_format
(string $field_string)
-
string
$field_string: The string to be checked.
Check that the given string is a valid email address.
Use not_empty first if string is required.
boolean
valid_email_format
(string $field_string)
-
string
$field_string: The string to be checked.