mirror of
				https://github.com/yiisoft/yii2.git
				synced 2025-10-31 18:47:33 +08:00 
			
		
		
		
	Fixes #13977: Skip validation if file input does not exist
This commit is contained in:
		 RobinKamps
					RobinKamps
				
			
				
					committed by
					
						 Alexander Makarov
						Alexander Makarov
					
				
			
			
				
	
			
			
			 Alexander Makarov
						Alexander Makarov
					
				
			
						parent
						
							8ac45fa962
						
					
				
				
					commit
					0f0e895475
				
			| @ -376,6 +376,12 @@ yii.validation = (function ($) { | ||||
|             return []; | ||||
|         } | ||||
|  | ||||
|         // Continue validation if file input does not exist | ||||
|         // (in case file inputs are added dynamically and no file input has been added to the form) | ||||
|         if (typeof $(attribute.input, attribute.$form).get(0) === "undefined") { | ||||
|             return []; | ||||
|         } | ||||
|  | ||||
|         var files = $(attribute.input, attribute.$form).get(0).files; | ||||
|         if (!files) { | ||||
|             messages.push(options.message); | ||||
|  | ||||
		Reference in New Issue
	
	Block a user