mirror of
				https://github.com/yiisoft/yii2.git
				synced 2025-10-30 18:17:00 +08:00 
			
		
		
		
	Fixes #14901: Fixed trim validation for radio/checkbox button
This commit is contained in:
		 Evgeniy Moiseenko
					Evgeniy Moiseenko
				
			
				
					committed by
					
						 Alexander Makarov
						Alexander Makarov
					
				
			
			
				
	
			
			
			 Alexander Makarov
						Alexander Makarov
					
				
			
						parent
						
							001e4c5aed
						
					
				
				
					commit
					b36639b288
				
			| @ -236,9 +236,15 @@ yii.validation = (function ($) { | ||||
|             } | ||||
|         }, | ||||
|  | ||||
|         trim: function ($form, attribute, options) { | ||||
|         trim: function ($form, attribute, options, value) { | ||||
|             var $input = $form.find(attribute.input); | ||||
|             var value = $input.val(); | ||||
|             var isCheckAble = $input.find('[type=radio]').is('[type=radio]') || $input.find('[type=checkbox]').is('[type=checkbox]'); | ||||
|  | ||||
|             if (!isCheckAble) { | ||||
|                 return value; | ||||
|             } | ||||
|  | ||||
|             value = $input.val(); | ||||
|             if (!options.skipOnEmpty || !pub.isEmpty(value)) { | ||||
|                 value = $.trim(value); | ||||
|                 $input.val(value); | ||||
|  | ||||
		Reference in New Issue
	
	Block a user