validation
From SkyPHP
Every time a value is submitted to be saved to the database using the aql class, the validation php file corresponding to that database field is executed.
After all values being submitted are validated, an array of error messages is returned. If the $error array is empty, then the data is inserted (or updated).
/validation/ {table name} / {field name} .php
Examples
Simple zipcode validation
/validation/address/zip.php
<? if ( strlen($value)!=5 ) $error[$field] = "Please enter a valid 5 digit zip code."; ?>
Member duplication checking
The $_POST array contains all values that were submitted by the form. The $field and $value variables contain this specific field's data.
/validation/member/status.php
<?
$aql = "member {
id
}
person {
where person.email_address ilike '{$_POST['email_address']}'
}";
$rs = aql::select($aql);
if ($rs) $error[$value] = "'$_POST['email_address']' is already in our system.";
?>
