Overview

Packages

  • awl
    • AuthPlugin
    • AwlDatabase
    • Browser
    • classEditor
    • DataEntry
    • DataUpdate
    • EMail
    • iCalendar
    • MenuSet
    • PgQuery
    • Session
    • Translation
    • User
    • Utilities
    • Validation
    • vCalendar
    • vComponent
    • XMLDocument
    • XMLElement
  • None

Classes

  • Validation
  • Overview
  • Package
  • Class

Class Validation

Rules used for validation of form fields.

Package: awl\Validation
Copyright: Catalyst IT Ltd
License: GNU GPL v2 or later
Author: Emily Mossman emily@mcmillan.net.nz
Located at Validation.php
Methods summary
public
# Validation( string $func_name )

Initialise a new validation.

Initialise a new validation.

Parameters

$func_name
The javascript function name to call onsubmit of the form
public
# AddRule( string $fieldname, string $error_message, string $function_name )

Adds a validation rule for a specific field upon submission of the form. You must call RenderRules below RenderFields when outputing the page

Adds a validation rule for a specific field upon submission of the form. You must call RenderRules below RenderFields when outputing the page

Parameters

$fieldname
The name of the field.
$error_message
The message to display on unsuccessful validation.
$function_name
The function to call to validate the field
public string
# RenderJavascript( string $prefix = "", string $prefix,… )

Returns the javascript for form validation using the rules.

Returns the javascript for form validation using the rules.

Parameters

$prefix
$onsubmit The name of the function called on submission of the form.
$prefix,…
Optional prefix for form fields.

Returns

string
HTML/Javascript for form validation.
public boolean
# Validate( object $object )

Validates the form according to it's rules.

Validates the form according to it's rules.

Parameters

$object
The data object that requires form validation.

Returns

boolean
True if the validation succeeded.
public boolean
# not_empty( string $field_string )

Checks if a string is empty

Checks if a string is empty

Parameters

$field_string
The field value that is being checked.

Returns

boolean
True if the string is not empty.
public boolean
# selected( string $field_string )

Checks that a string is not empty or zero

Checks that a string is not empty or zero

Parameters

$field_string
$select_string The select value that is being checked.

Returns

boolean
True if the string is not empty or equal to 0.
public boolean
# positive_dollars( string $field_string )

Check that the given string is a positive dollar amount. Use not_empty first if string is required.

Check that the given string is a positive dollar amount. Use not_empty first if string is required.

Parameters

$field_string
The amount to be checked.

Returns

boolean
Returns true if the given string is a positive dollar amount.
public boolean
# positive_integer( string $field_string )

Check that the given string is a positive integer. Use not_empty first if string is required.

Check that the given string is a positive integer. Use not_empty first if string is required.

Parameters

$field_string
The amount to be checked.

Returns

boolean
Returns true if the given string is a positive integer.
public boolean
# valid_email_format( string $field_string )

Check that the given string is a valid email address. Use not_empty first if string is required.

Check that the given string is a valid email address. Use not_empty first if string is required.

Parameters

$field_string
The string to be checked.

Returns

boolean
Returns true if the given string is a valid email address.
public boolean
# valid_date_format( string $field_string )

Check that the given string matches the user's date format. Use not_empty first if string is required.

Check that the given string matches the user's date format. Use not_empty first if string is required.

Parameters

$field_string
The string to be checked.

Returns

boolean
Returns true if the given string matches the user's date format from session.
Properties summary
public Validation::$rules $rules

List of rules for validation

List of rules for validation

# array()
public Validation::$func_name $func_name

The javascript function name to call onsubmit of the form

The javascript function name to call onsubmit of the form

# ""
API documentation generated by ApiGen