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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Rotua Panjaitan
yii2
Commits
a32753b5
Commit
a32753b5
authored
Feb 13, 2014
by
Borales
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#2417 Possibility to specify dataType for $.ajax call in yii.activeForm.js
parent
f53863d7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
2 deletions
+9
-2
yii.activeForm.js
framework/assets/yii.activeForm.js
+4
-2
ActiveForm.php
framework/widgets/ActiveForm.php
+5
-0
No files found.
framework/assets/yii.activeForm.js
View file @
a32753b5
...
...
@@ -45,7 +45,9 @@
// function ($form, attribute, messages)
afterValidate
:
undefined
,
// the GET parameter name indicating an AJAX-based validation
ajaxVar
:
'ajax'
ajaxVar
:
'ajax'
,
// the type of data that you're expecting back from the server
ajaxDataType
:
'json'
};
var
attributeDefaults
=
{
...
...
@@ -301,7 +303,7 @@
url
:
data
.
settings
.
validationUrl
,
type
:
$form
.
prop
(
'method'
),
data
:
$form
.
serialize
()
+
extData
,
dataType
:
'json'
,
dataType
:
data
.
settings
.
ajaxDataType
,
success
:
function
(
msgs
)
{
if
(
msgs
!==
null
&&
typeof
msgs
===
'object'
)
{
$
.
each
(
data
.
attributes
,
function
()
{
...
...
framework/widgets/ActiveForm.php
View file @
a32753b5
...
...
@@ -104,6 +104,10 @@ class ActiveForm extends Widget
*/
public
$ajaxVar
=
'ajax'
;
/**
* @var string the type of data that you're expecting back from the server.
*/
public
$ajaxDataType
=
'json'
;
/**
* @var string|JsExpression a JS callback that will be called when the form is being submitted.
* The signature of the callback should be:
*
...
...
@@ -187,6 +191,7 @@ class ActiveForm extends Widget
'successCssClass'
=>
$this
->
successCssClass
,
'validatingCssClass'
=>
$this
->
validatingCssClass
,
'ajaxVar'
=>
$this
->
ajaxVar
,
'ajaxDataType'
=>
$this
->
ajaxDataType
,
];
if
(
$this
->
validationUrl
!==
null
)
{
$options
[
'validationUrl'
]
=
Html
::
url
(
$this
->
validationUrl
);
...
...
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