mirror of
https://github.com/yiisoft/yii2.git
synced 2025-10-30 18:17:00 +08:00
Fixes #13977: Skip validation if file input does not exist
This commit is contained in:
committed by
Alexander Makarov
parent
8ac45fa962
commit
0f0e895475
@ -376,6 +376,12 @@ yii.validation = (function ($) {
|
||||
return [];
|
||||
}
|
||||
|
||||
// Continue validation if file input does not exist
|
||||
// (in case file inputs are added dynamically and no file input has been added to the form)
|
||||
if (typeof $(attribute.input, attribute.$form).get(0) === "undefined") {
|
||||
return [];
|
||||
}
|
||||
|
||||
var files = $(attribute.input, attribute.$form).get(0).files;
|
||||
if (!files) {
|
||||
messages.push(options.message);
|
||||
|
||||
Reference in New Issue
Block a user