Validation
class Validation (View source)
Helper functions to use with validating submitting forms.
\@package Helpers
Constants
| VALID_NOT_EMPTY | 
                     
  | 
            
| VALID_EMAIL | 
                     
  | 
            
| VALID_INTEGER | 
                     
  | 
            
| VALID_INTEGER_REQUIRED | 
                     
  | 
            
| VALID_UPLOADED_IMAGE | 
                     
  | 
            
| VALID_UPLOADED_IMAGE_REQUIRED | 
                     
  | 
            
| VALID_UPLOADED_FILE | 
                     
  | 
            
| VALID_UPLOADED_FILE_REQUIRED | 
                     
  | 
            
| VALID_TOKEN | 
                     
  | 
            
| VALID_FIELD_INVALID | 
                     
  | 
            
Properties
| protected | $fields | ||
| protected | $fieldsInvalid | ||
| protected | $data | ||
| protected | $files | ||
| protected | $error | 
Methods
No description
Adds a test to a field to ensure that, if set, it is a valid uploaded image.
Adds a required field to the form helper object. This will then be typically used in conjunction with the test() method to see if the test is passed.
Adds a test to a field to ensure that, if set, it is a valid uploaded file.
Adds a required field and tests that it is integer only.
No description
Adds a required email address to the suite of tests to be run.
Sets the data files array.
An associative array that we setup to validate against. Typical usage is $val->setData($_POST);.
No description
After the validation error helper has been setup, the test() method ensures that all fields that require validation pass. Returns true for success and false for failure.
No description
No description
Details
        
                            
    __construct()
        
    
    No description
        
                            
    addUploadedImage(string $field, string $errorMsg = null, bool $emptyIsOk = true)
        
    
    Adds a test to a field to ensure that, if set, it is a valid uploaded image.
        
                            
    addRequired(string $field, string $errorMsg = null, string $validate = self::VALID_NOT_EMPTY)
        
    
    Adds a required field to the form helper object. This will then be typically used in conjunction with the test() method to see if the test is passed.
        
                            
    addUploadedFile(string $field, string $errorMsg = null, bool $emptyIsOk = true)
        
    
    Adds a test to a field to ensure that, if set, it is a valid uploaded file.
        
                            
    addInteger(string $field, string $errorMsg = null, bool $emptyIsOk = true)
        
    
    Adds a required field and tests that it is integer only.
        
                            
    addRequiredToken($value, $errorMsg = null)
        
    
    No description
        
                            
    addRequiredEmail(string $field, string $errorMsg = null)
        
    
    Adds a required email address to the suite of tests to be run.
        
                            
    setFiles()
        
    
    Sets the data files array.
        
                            
    setData(array $data)
        
    
    An associative array that we setup to validate against. Typical usage is $val->setData($_POST);.
        
                            
    invalidate($message)
        
    
    No description
        
                            bool
    test()
        
    
    After the validation error helper has been setup, the test() method ensures that all fields that require validation pass. Returns true for success and false for failure.
        
                    protected        
    setErrorsFromInvalidFields()
        
    
    No description
        
                            
    getError()
        
    
    No description