Changeset 2334

Show
Ignore:
Timestamp:
03/24/2008 09:56:23 AM (8 months ago)
Author:
Shadowhand
Message:

Added preliminary support for $submitted status to Validation

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/system/libraries/Validation.php

    r2223 r2334  
    3030        protected $messages = array(); 
    3131 
     32        // Checks if there is data to validate. 
     33        protected $submitted; 
     34 
    3235        /** 
    3336         * Creates a new Validation instance. 
     
    5255                // Set a dynamic, unique "any field" key 
    5356                $this->any_field = uniqid(NULL, TRUE); 
     57 
     58                // Test if there is any actual data 
     59                $this->submitted = (count($array) > 0); 
    5460 
    5561                parent::__construct($array, ArrayObject::ARRAY_AS_PROPS | ArrayObject::STD_PROP_LIST); 
     
    312318                )); 
    313319 
    314                 // Only run validation when POST data exists 
    315                 $run_validation = (count($this) > 0); 
    316  
    317320                foreach ($all_fields as $i => $field) 
    318321                { 
     
    328331                } 
    329332 
    330                 if ($run_validation === FALSE) 
     333                if ($this->submitted === FALSE) 
    331334                        return FALSE; 
    332335