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 the number of invalid fields (0 = success).
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
        
                            int
    test()
        
    
    After the validation error helper has been setup, the test() method ensures that all fields that require validation pass. Returns the number of invalid fields (0 = success).
        
                    protected        
    setErrorsFromInvalidFields()
        
    
    No description
        
                            
    getError()
        
    
    No description