Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
drupal.org
clientside_validation
Commits
4bf5b2d0
Commit
4bf5b2d0
authored
Apr 05, 2013
by
Jelle Sebreghts
Browse files
support ctools modal
parent
8ce65973
Changes
1
Hide whitespace changes
Inline
Side-by-side
clientside_validation.js
View file @
4bf5b2d0
...
...
@@ -1347,4 +1347,32 @@
}
};
Drupal
.
behaviors
.
ZZZClientsideValidation
=
{
attach
:
function
()
{
// Set validation for ctools modal forms
for
(
var
ajax_el
in
Drupal
.
ajax
)
{
if
(
typeof
Drupal
.
ajax
[
ajax_el
]
!==
'
undefined
'
)
{
var
origBeforeSubmit
=
Drupal
.
ajax
[
ajax_el
].
options
.
beforeSubmit
;
Drupal
.
ajax
[
ajax_el
].
options
.
beforeSubmit
=
function
(
form_values
,
element
,
options
)
{
var
ret
=
origBeforeSubmit
(
form_values
,
element
,
options
);
// If this function didn't return anything, just set the return value to true.
// If it did return something, allow it to prevent submit if necessary.
if
(
typeof
ret
===
'
undefined
'
)
{
ret
=
true
;
}
var
id
=
element
.
is
(
'
form
'
)
?
element
.
attr
(
'
id
'
)
:
element
.
closest
(
'
form
'
).
attr
(
'
id
'
);
if
(
id
&&
Drupal
.
myClientsideValidation
.
validators
[
id
])
{
Drupal
.
myClientsideValidation
.
validators
[
id
].
onsubmit
=
false
;
ret
=
ret
&&
Drupal
.
myClientsideValidation
.
validators
[
id
].
form
();
if
(
!
ret
)
{
Drupal
.
ajax
[
ajax_el
].
ajaxing
=
false
;
}
}
return
ret
;
};
}
}
}
}
})(
jQuery
);
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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