mirror of
				https://github.com/yiisoft/yii2.git
				synced 2025-10-31 10:39:59 +08:00 
			
		
		
		
	Fixes #6361: Added validateAttribute() to yii.activeForm.js to support manually triggering data validation of an input
				
					
				
			This commit is contained in:
		| @ -227,6 +227,14 @@ | ||||
|             return attribute; | ||||
|         }, | ||||
|  | ||||
|         // manually trigger the validation of the attribute with the specified ID | ||||
|         validateAttribute: function (id) { | ||||
|             var attribute = methods.find(id); | ||||
|             if (attribute != undefined) { | ||||
|                 validateAttribute($(this), attribute, true); | ||||
|             } | ||||
|         }, | ||||
|  | ||||
|         // find an attribute config based on the specified attribute ID | ||||
|         find: function (id) { | ||||
|             var attributes = $(this).data('yiiActiveForm').attributes, | ||||
| @ -251,6 +259,7 @@ | ||||
|             return this.data('yiiActiveForm'); | ||||
|         }, | ||||
|  | ||||
|         // validate all applicable inputs in the form | ||||
|         validate: function () { | ||||
|             var $form = $(this), | ||||
|                 data = $form.data('yiiActiveForm'), | ||||
| @ -413,9 +422,6 @@ | ||||
|                 } | ||||
|             }); | ||||
|         } | ||||
|         $input.on('forceValidate.yiiActiveForm', function() { | ||||
|             validateAttribute($form, attribute, true); | ||||
|         }); | ||||
|     }; | ||||
|  | ||||
|     var unwatchAttribute = function ($form, attribute) { | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Qiang Xue
					Qiang Xue