mirror of
				https://github.com/yiisoft/yii2.git
				synced 2025-11-01 03:26:36 +08:00 
			
		
		
		
	 Evgeniy Moiseenko
					Evgeniy Moiseenko
				
			
				
					committed by
					
						 Alexander Makarov
						Alexander Makarov
					
				
			
			
				
	
			
			
			 Alexander Makarov
						Alexander Makarov
					
				
			
						parent
						
							7c76696905
						
					
				
				
					commit
					cfe0bf5cf1
				
			| @ -4,6 +4,7 @@ Yii Framework 2 Change Log | |||||||
| 2.0.16 under development | 2.0.16 under development | ||||||
| ------------------------ | ------------------------ | ||||||
|  |  | ||||||
|  | - Bug #14039, #16636: Fixed validation for disabled inputs (s1lver, omzy83) | ||||||
| - Bug #16425: Check for additional values for disabled confirm dialog (Alex-Code, s1lver) | - Bug #16425: Check for additional values for disabled confirm dialog (Alex-Code, s1lver) | ||||||
| - Enh #14367: In `yii\db\mysql\QueryBuilder` added support fractional seconds for time types for MySQL >= 5.6.4 (konstantin-vl) | - Enh #14367: In `yii\db\mysql\QueryBuilder` added support fractional seconds for time types for MySQL >= 5.6.4 (konstantin-vl) | ||||||
| - Bug #16766: `yii\filters\ContentNegotiator` was not setting `Vary` header to inform cache recipients (koteq, cebe, samdark) | - Bug #16766: `yii\filters\ContentNegotiator` was not setting `Vary` header to inform cache recipients (koteq, cebe, samdark) | ||||||
|  | |||||||
| @ -325,7 +325,7 @@ | |||||||
|             // client-side validation |             // client-side validation | ||||||
|             $.each(data.attributes, function () { |             $.each(data.attributes, function () { | ||||||
|                 this.$form = $form; |                 this.$form = $form; | ||||||
|                 if (!$(this.input).is(":disabled")) { |                 if (!findInput($form, this).is(":disabled")) { | ||||||
|                     this.cancelled = false; |                     this.cancelled = false; | ||||||
|                     // perform validation only if the form is being submitted or if an attribute is pending validation |                     // perform validation only if the form is being submitted or if an attribute is pending validation | ||||||
|                     if (data.submitting || this.status === 2 || this.status === 3) { |                     if (data.submitting || this.status === 2 || this.status === 3) { | ||||||
| @ -489,7 +489,6 @@ | |||||||
|                 updateInput($(this), attribute, msg); |                 updateInput($(this), attribute, msg); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |  | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
|     var watchAttribute = function ($form, attribute) { |     var watchAttribute = function ($form, attribute) { | ||||||
| @ -625,8 +624,9 @@ | |||||||
|  |  | ||||||
|         if (submitting) { |         if (submitting) { | ||||||
|             var errorAttributes = []; |             var errorAttributes = []; | ||||||
|  |             var $input = findInput($form, this); | ||||||
|             $.each(data.attributes, function () { |             $.each(data.attributes, function () { | ||||||
|                 if (!$(this.input).is(":disabled") && !this.cancelled && updateInput($form, this, messages)) { |                 if (!$input.is(":disabled") && !this.cancelled && updateInput($form, this, messages)) { | ||||||
|                     errorAttributes.push(this); |                     errorAttributes.push(this); | ||||||
|                 } |                 } | ||||||
|             }); |             }); | ||||||
|  | |||||||
| @ -1,3 +1,37 @@ | |||||||
| <form id="w0"> | <form id="w0"> | ||||||
|     <input id="name" type="text" name="name" value=""> |     <input id="name" type="text" name="name" value=""> | ||||||
| </form> | </form> | ||||||
|  |  | ||||||
|  | <form id="w1"> | ||||||
|  |     <fieldset disabled=""> | ||||||
|  |         <div class="form-group required"> | ||||||
|  |             <label class="control-label" for="test_text">Test text</label> | ||||||
|  |             <input type="text" id="test_text" class="form-control" name="Test[text]" aria-required="true"> | ||||||
|  |             <div class="help-block"></div> | ||||||
|  |         </div> | ||||||
|  |     </fieldset> | ||||||
|  |  | ||||||
|  |     <fieldset disabled=""> | ||||||
|  |         <div class="form-group required"> | ||||||
|  |             <label class="control-label">Test radio</label> | ||||||
|  |             <input type="hidden" name="Test[radio]" value=""> | ||||||
|  |             <div id="test_radio" aria-required="true"> | ||||||
|  |                 <label><input type="radio" name="Test[radio]" value="1"> Test1</label> | ||||||
|  |                 <label><input type="radio" name="Test[radio]" value="0"> Test2</label> | ||||||
|  |             </div> | ||||||
|  |             <div class="help-block"></div> | ||||||
|  |         </div> | ||||||
|  |     </fieldset> | ||||||
|  |  | ||||||
|  |     <fieldset disabled=""> | ||||||
|  |         <div class="form-group required"> | ||||||
|  |             <label class="control-label">Test checkbox</label> | ||||||
|  |             <input type="hidden" name="Test[checkbox]" value=""> | ||||||
|  |             <div id="test_checkbox" aria-required="true"> | ||||||
|  |                 <label><input type="checkbox" name="Test[checkbox][]" value="1"> Test1</label> | ||||||
|  |                 <label><input type="checkbox" name="Test[checkbox][]" value="0"> Test2</label> | ||||||
|  |             </div> | ||||||
|  |             <div class="help-block"></div> | ||||||
|  |         </div> | ||||||
|  |     </fieldset> | ||||||
|  | </form> | ||||||
| @ -78,6 +78,32 @@ describe('yii.activeForm', function () { | |||||||
|                 assert.isTrue(afterValidateSpy.calledOnce); |                 assert.isTrue(afterValidateSpy.calledOnce); | ||||||
|             }); |             }); | ||||||
|         }); |         }); | ||||||
|  |          | ||||||
|  |         describe('with disabled fields', function () { | ||||||
|  |             var inputTypes = { | ||||||
|  |                 test_radio: 'radioList', | ||||||
|  |                 test_checkbox: 'checkboxList', | ||||||
|  |                 test_text: 'text input' | ||||||
|  |             }; | ||||||
|  |  | ||||||
|  |             for (var key in inputTypes) { | ||||||
|  |                 if (inputTypes.hasOwnProperty(key)) { | ||||||
|  |                     (function () { | ||||||
|  |                         var inputId = key; | ||||||
|  |                         it(inputTypes[key] + ' disabled field', function () { | ||||||
|  |                             $activeForm = $('#w1'); | ||||||
|  |                             $activeForm.yiiActiveForm({ | ||||||
|  |                                 id: inputId, | ||||||
|  |                                 input: '#' + inputId | ||||||
|  |                             }); | ||||||
|  |                             $activeForm.yiiActiveForm('validate'); | ||||||
|  |  | ||||||
|  |                             assert.isFalse($activeForm.data('yiiActiveForm').validated); | ||||||
|  |                         }); | ||||||
|  |                     })(); | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |         }); | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|     describe('resetForm method', function () { |     describe('resetForm method', function () { | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user