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
9fc4c380
Commit
9fc4c380
authored
May 03, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
form wip
parent
aa8061b0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
23 deletions
+27
-23
yii.activeForm.js
framework/assets/yii.activeForm.js
+27
-23
No files found.
framework/assets/yii.activeForm.js
View file @
9fc4c380
...
@@ -123,7 +123,7 @@
...
@@ -123,7 +123,7 @@
},
},
submitForm
:
function
()
{
submitForm
:
function
()
{
var
$form
=
$
(
this
)
,
var
$form
=
this
,
data
=
$form
.
data
(
'yiiActiveForm'
);
data
=
$form
.
data
(
'yiiActiveForm'
);
if
(
data
.
validated
)
{
if
(
data
.
validated
)
{
// continue submitting the form since validation passes
// continue submitting the form since validation passes
...
@@ -142,7 +142,7 @@
...
@@ -142,7 +142,7 @@
hasError
=
updateInput
(
$form
,
this
,
messages
)
||
hasError
;
hasError
=
updateInput
(
$form
,
this
,
messages
)
||
hasError
;
});
});
updateSummary
(
$form
,
messages
);
updateSummary
(
$form
,
messages
);
if
(
!
data
.
settings
.
afterValidate
||
data
.
settings
.
afterValidate
(
$form
,
data
,
hasError
))
{
if
(
!
data
.
settings
.
afterValidate
||
data
.
settings
.
afterValidate
(
$form
,
messages
,
hasError
))
{
if
(
!
hasError
)
{
if
(
!
hasError
)
{
data
.
validated
=
true
;
data
.
validated
=
true
;
var
$button
=
data
.
submitObject
||
$form
.
find
(
':submit:first'
);
var
$button
=
data
.
submitObject
||
$form
.
find
(
':submit:first'
);
...
@@ -167,7 +167,7 @@
...
@@ -167,7 +167,7 @@
},
},
resetForm
:
function
()
{
resetForm
:
function
()
{
var
$form
=
$
(
this
)
;
var
$form
=
this
;
var
data
=
$form
.
data
(
'yiiActiveForm'
);
var
data
=
$form
.
data
(
'yiiActiveForm'
);
// Because we bind directly to a form reset event instead of a reset button (that may not exist),
// Because we bind directly to a form reset event instead of a reset button (that may not exist),
// when this function is executed form input values have not been reset yet.
// when this function is executed form input values have not been reset yet.
...
@@ -190,26 +190,6 @@
...
@@ -190,26 +190,6 @@
}
}
};
};
var
getValue
=
function
(
$form
,
attribute
)
{
var
$input
=
findInput
(
$form
,
attribute
);
var
type
=
$input
.
attr
(
'type'
);
if
(
type
===
'checkbox'
||
type
===
'radio'
)
{
return
$input
.
filter
(
':checked'
).
val
();
}
else
{
return
$input
.
val
();
}
};
var
findInput
=
function
(
$form
,
attribute
)
{
var
$input
=
$form
.
find
(
attribute
.
input
);
if
(
$input
.
length
&&
$input
[
0
].
tagName
.
toLowerCase
()
===
'div'
)
{
// checkbox list or radio list
return
$input
.
find
(
'input'
);
}
else
{
return
$input
;
}
};
var
watchAttributes
=
function
(
$form
,
attributes
)
{
var
watchAttributes
=
function
(
$form
,
attributes
)
{
$
.
each
(
attributes
,
function
(
i
,
attribute
)
{
$
.
each
(
attributes
,
function
(
i
,
attribute
)
{
var
$input
=
findInput
(
$form
,
attribute
);
var
$input
=
findInput
(
$form
,
attribute
);
...
@@ -304,6 +284,9 @@
...
@@ -304,6 +284,9 @@
});
});
if
(
needAjaxValidation
&&
(
!
data
.
submitting
||
$
.
isEmptyObject
(
messages
)))
{
if
(
needAjaxValidation
&&
(
!
data
.
submitting
||
$
.
isEmptyObject
(
messages
)))
{
// Perform ajax validation when at least one input needs it.
// If the validation is triggered by form submission, ajax validation
// should be done only when all inputs pass client validation
var
$button
=
data
.
submitObject
,
var
$button
=
data
.
submitObject
,
extData
=
'&'
+
data
.
settings
.
ajaxVar
+
'='
+
$form
.
attr
(
'id'
);
extData
=
'&'
+
data
.
settings
.
ajaxVar
+
'='
+
$form
.
attr
(
'id'
);
if
(
$button
&&
$button
.
length
&&
$button
.
attr
(
'name'
))
{
if
(
$button
&&
$button
.
length
&&
$button
.
attr
(
'name'
))
{
...
@@ -389,4 +372,24 @@
...
@@ -389,4 +372,24 @@
}
}
};
};
var
getValue
=
function
(
$form
,
attribute
)
{
var
$input
=
findInput
(
$form
,
attribute
);
var
type
=
$input
.
attr
(
'type'
);
if
(
type
===
'checkbox'
||
type
===
'radio'
)
{
return
$input
.
filter
(
':checked'
).
val
();
}
else
{
return
$input
.
val
();
}
};
var
findInput
=
function
(
$form
,
attribute
)
{
var
$input
=
$form
.
find
(
attribute
.
input
);
if
(
$input
.
length
&&
$input
[
0
].
tagName
.
toLowerCase
()
===
'div'
)
{
// checkbox list or radio list
return
$input
.
find
(
'input'
);
}
else
{
return
$input
;
}
};
})(
window
.
jQuery
);
})(
window
.
jQuery
);
\ No newline at end of file
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