File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ Yii Framework 2 Change Log
4
4
2.0.16 under development
5
5
------------------------
6
6
7
+ - Bug #13977 : Skip validation if file input does not exist (RobinKamps, s1lver)
7
8
- Bug #16183 : Fixed when ` yii\helpers\BaseFileHelper ` sometimes returned wrong value (samdark, SilverFire, OndrejVasicek)
8
9
- Bug #13932 : Fix number validator attributes comparison (uaoleg, s1lver)
9
10
- Bug #14039 , #16636 : Fixed validation for disabled inputs (s1lver, omzy83)
Original file line number Diff line number Diff line change @@ -376,13 +376,15 @@ yii.validation = (function ($) {
376
376
return [ ] ;
377
377
}
378
378
379
- // Continue validation if file input does not exist
379
+ var fileInput = $ ( attribute . input , attribute . $form ) . get ( 0 ) ;
380
+
381
+ // Skip validation if file input does not exist
380
382
// (in case file inputs are added dynamically and no file input has been added to the form)
381
- if ( typeof $ ( attribute . input , attribute . $form ) . get ( 0 ) === "undefined" ) {
383
+ if ( typeof fileInput === "undefined" ) {
382
384
return [ ] ;
383
385
}
384
386
385
- var files = $ ( attribute . input , attribute . $form ) . get ( 0 ) . files ;
387
+ var files = fileInput . files ;
386
388
if ( ! files ) {
387
389
messages . push ( options . message ) ;
388
390
return [ ] ;
You can’t perform that action at this time.
0 commit comments