Add "equals" parameter to form validator
							parent
							
								
									6a6e7db2ce
								
							
						
					
					
						commit
						390aa89d9f
					
				|  | @ -9,11 +9,16 @@ class FormValidator { | |||
| 
 | ||||
|     public function isValid(array $req) { | ||||
|         foreach($fieldValidation as $field => $params) { | ||||
|             if($params['required'] && !isset($req[$field])) { | ||||
|             if($params['required'] && (!isset($req[$field]) || strlen($req[$field]) == 0)) { | ||||
|                 return false; | ||||
|             } | ||||
| 
 | ||||
|             if(isset($params['regex']) && !preg_match($params['regex'], $req[$field])) { | ||||
|             if(isset($params['regex'])) { | ||||
|                 if(!preg_match($params['regex'], $req[$field])) { | ||||
|                     return false; | ||||
|                 } | ||||
|             } | ||||
|             else if(isset($params['equals']) && $params['equals'] !== $req[$field]) { | ||||
|                 return false; | ||||
|             } | ||||
|         } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 Anonymous Contributor
						Anonymous Contributor