mirror of
				https://github.com/yiisoft/yii2.git
				synced 2025-10-31 10:39:59 +08:00 
			
		
		
		
	Fixes #5124: Added support to prevent duplicated form submission when using ActiveForm
				
					
				
			This commit is contained in:
		| @ -349,11 +349,15 @@ | ||||
|                 data = $form.data('yiiActiveForm'); | ||||
|  | ||||
|             if (data.validated) { | ||||
|                 if (!data.submitting) { | ||||
|                     // form is being submitted. Do nothing to avoid duplicated form submission | ||||
|                     return false; | ||||
|                 } | ||||
|                 data.submitting = false; | ||||
|                 var event = $.Event(events.beforeSubmit); | ||||
|                 $form.trigger(event, [$form]); | ||||
|                 $form.trigger(event); | ||||
|                 if (event.result === false) { | ||||
|                     data.validated = false; | ||||
|                     data.submitting = false; | ||||
|                     return false; | ||||
|                 } | ||||
|                 return true;   // continue submitting the form since validation passes | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Qiang Xue
					Qiang Xue