mirror of
				https://github.com/yiisoft/yii2.git
				synced 2025-11-01 03:26:36 +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 []; |             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; |         var files = $(attribute.input, attribute.$form).get(0).files; | ||||||
|         if (!files) { |         if (!files) { | ||||||
|             messages.push(options.message); |             messages.push(options.message); | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user