Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
95460f92
Commit
95460f92
authored
Jul 23, 2014
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #4360: Added client validation support for file validator
parent
1a3a266f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
19 deletions
+20
-19
CHANGELOG.md
framework/CHANGELOG.md
+1
-0
yii.validation.js
framework/assets/yii.validation.js
+19
-19
No files found.
framework/CHANGELOG.md
View file @
95460f92
...
@@ -147,6 +147,7 @@ Yii Framework 2 Change Log
...
@@ -147,6 +147,7 @@ Yii Framework 2 Change Log
-
Enh #4209: Added
`beforeCopy`
,
`afterCopy`
,
`forceCopy`
properties to AssetManager (cebe)
-
Enh #4209: Added
`beforeCopy`
,
`afterCopy`
,
`forceCopy`
properties to AssetManager (cebe)
-
Enh #4297: Added check for DOM extension to requirements (samdark)
-
Enh #4297: Added check for DOM extension to requirements (samdark)
-
Enh #4317: Added
`absoluteAuthTimeout`
to yii
\w
eb
\U
ser (ivokund, nkovacs)
-
Enh #4317: Added
`absoluteAuthTimeout`
to yii
\w
eb
\U
ser (ivokund, nkovacs)
-
Enh #4360: Added client validation support for file validator (Skysplit)
-
Enh: Added support for using sub-queries when building a DB query with
`IN`
condition (qiangxue)
-
Enh: Added support for using sub-queries when building a DB query with
`IN`
condition (qiangxue)
-
Enh: Supported adding a new response formatter without the need to reconfigure existing formatters (qiangxue)
-
Enh: Supported adding a new response formatter without the need to reconfigure existing formatters (qiangxue)
-
Enh: Added
`yii\web\UrlManager::addRules()`
to simplify adding new URL rules (qiangxue)
-
Enh: Added
`yii\web\UrlManager::addRules()`
to simplify adding new URL rules (qiangxue)
...
...
framework/assets/yii.validation.js
View file @
95460f92
...
@@ -17,7 +17,7 @@ yii.validation = (function ($) {
...
@@ -17,7 +17,7 @@ yii.validation = (function ($) {
},
},
addMessage
:
function
(
messages
,
message
,
value
)
{
addMessage
:
function
(
messages
,
message
,
value
)
{
messages
.
push
(
message
.
replace
(
/
\{
(
value|file
)
\}
/g
,
value
));
messages
.
push
(
message
.
replace
(
/
\{
value
\}
/g
,
value
));
},
},
required
:
function
(
value
,
messages
,
options
)
{
required
:
function
(
value
,
messages
,
options
)
{
...
@@ -69,51 +69,51 @@ yii.validation = (function ($) {
...
@@ -69,51 +69,51 @@ yii.validation = (function ($) {
}
}
},
},
file
:
function
(
value
,
messages
,
options
,
attribute
)
{
file
:
function
(
value
,
messages
,
options
,
attribute
)
{
var
files
=
$
(
attribute
.
input
).
get
(
0
).
files
,
var
files
=
$
(
attribute
.
input
).
get
(
0
).
files
,
index
,
ext
;
index
,
ext
;
if
(
options
.
message
&&
!
files
)
{
if
(
options
.
message
&&
!
files
)
{
pub
.
addMessage
(
messages
,
options
.
message
,
value
);
pub
.
addMessage
(
messages
,
options
.
message
,
value
);
}
}
if
(
!
options
.
skipOnEmpty
&&
files
.
length
==
0
)
{
if
(
!
options
.
skipOnEmpty
&&
files
.
length
==
0
)
{
pub
.
addMessage
(
messages
,
options
.
uploadRequired
,
value
);
pub
.
addMessage
(
messages
,
options
.
uploadRequired
,
value
);
}
else
if
(
files
.
length
==
0
)
{
}
else
if
(
files
.
length
==
0
)
{
return
;
return
;
}
}
if
(
options
.
maxFiles
&&
options
.
maxFiles
<
files
.
length
)
{
if
(
options
.
maxFiles
&&
options
.
maxFiles
<
files
.
length
)
{
pub
.
addMessage
(
messages
,
options
.
tooMany
);
pub
.
addMessage
(
messages
,
options
.
tooMany
);
}
}
$
(
files
).
each
(
function
(
i
,
file
)
{
$
.
each
(
files
,
function
(
i
,
file
)
{
if
(
options
.
extensions
&&
options
.
extensions
.
length
>
0
)
{
if
(
options
.
extensions
&&
options
.
extensions
.
length
>
0
)
{
index
=
file
.
name
.
lastIndexOf
(
'.'
);
index
=
file
.
name
.
lastIndexOf
(
'.'
);
if
(
!~
index
)
{
if
(
!~
index
)
{
ext
=
''
;
ext
=
''
;
}
else
{
}
else
{
ext
=
file
.
name
.
substr
(
index
+
1
,
file
.
name
.
length
).
toLowerCase
();
ext
=
file
.
name
.
substr
(
index
+
1
,
file
.
name
.
length
).
toLowerCase
();
}
}
if
(
!~
options
.
extensions
.
indexOf
(
ext
)
)
{
if
(
!~
options
.
extensions
.
indexOf
(
ext
)
)
{
pub
.
addMessage
(
messages
,
options
.
wrongExtension
,
file
.
name
);
messages
.
push
(
options
.
wrongExtension
.
replace
(
/
\{
file
\}
/g
,
file
.
name
)
);
}
}
}
}
if
(
options
.
mimeTypes
&&
options
.
mimeTypes
.
length
>
0
)
{
if
(
options
.
mimeTypes
&&
options
.
mimeTypes
.
length
>
0
)
{
if
(
!~
options
.
mimeTypes
.
indexOf
(
file
.
type
)
)
{
if
(
!~
options
.
mimeTypes
.
indexOf
(
file
.
type
)
)
{
pub
.
addMessage
(
messages
,
options
.
wrongMimeType
,
file
.
name
);
messages
.
push
(
options
.
wrongMimeType
.
replace
(
/
\{
file
\}
/g
,
file
.
name
)
);
}
}
}
}
if
(
options
.
maxSize
&&
options
.
maxSize
<
file
.
size
)
{
if
(
options
.
maxSize
&&
options
.
maxSize
<
file
.
size
)
{
pub
.
addMessage
(
messages
,
options
.
tooBig
,
file
.
name
);
messages
.
push
(
options
.
tooBig
.
replace
(
/
\{
file
\}
/g
,
file
.
name
)
);
}
}
if
(
options
.
maxSize
&&
options
.
minSize
>
file
.
size
)
{
if
(
options
.
maxSize
&&
options
.
minSize
>
file
.
size
)
{
pub
.
addMessage
(
messages
,
options
.
tooSmall
,
file
.
name
);
messages
.
push
(
options
.
tooSmall
.
replace
(
/
\{
file
\}
/g
,
file
.
name
)
);
}
}
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment