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
18eb0b67
Commit
18eb0b67
authored
Aug 04, 2011
by
Jelle Sebreghts
Browse files
fix for #1239192 and #1239128. Special thanks to mjpa
parent
6860f59a
Changes
3
Hide whitespace changes
Inline
Side-by-side
clientside_validation.js
View file @
18eb0b67
...
...
@@ -5,6 +5,9 @@
Drupal
.
myClientsideValidation
=
new
Drupal
.
clientsideValidation
();
}
else
{
// Update the settings
Drupal
.
myClientsideValidation
.
data
=
Drupal
.
settings
.
clientsideValidation
;
Drupal
.
myClientsideValidation
.
forms
=
Drupal
.
myClientsideValidation
.
data
[
'
forms
'
];
Drupal
.
myClientsideValidation
.
bindForms
();
}
}
...
...
@@ -138,10 +141,10 @@
}
};
if
(
!
Drupal
.
settings
.
clientsideValidation
.
forms
[
f
].
includeHidden
)
{
if
(
!
self
.
forms
[
f
].
includeHidden
)
{
validate_options
.
ignore
=
'
:input:hidden
'
;
}
if
(
Drupal
.
settings
.
clientsideValidation
.
general
.
validateTabs
)
{
if
(
self
.
data
.
general
.
validateTabs
)
{
validate_options
.
ignore
+=
'
:not(.vertical-tabs-pane:input)
'
;
}
self
.
validators
[
f
]
=
$
(
'
#
'
+
f
).
validate
(
validate_options
);
...
...
clientside_validation.module
View file @
18eb0b67
...
...
@@ -235,6 +235,11 @@ function clientside_validation_webform_after_build(&$form, &$form_state) {
*/
function
clientside_validation_form_after_build
(
&
$form
,
&
$form_state
)
{
static
$js_rules
=
array
();
static
$form_ids
=
array
();
if
(
isset
(
$form_ids
[
$form
[
'#id'
]]))
{
return
$form
;
}
drupal_alter
(
"clientside_validation_form"
,
$form
,
$form_state
,
$js_rules
);
if
(
!
empty
(
$js_rules
))
{
$settings
[
'clientsideValidation'
][
'general'
]
=
array
(
...
...
@@ -270,6 +275,7 @@ function clientside_validation_form_after_build(&$form, &$form_state) {
}
drupal_add_js
(
drupal_get_path
(
'module'
,
'clientside_validation'
)
.
'/clientside_validation.js'
);
drupal_add_js
(
$settings
,
'setting'
);
$form_ids
[
$form
[
'#id'
]]
=
TRUE
;
}
return
$form
;
...
...
clientside_validation_form/clientside_validation_form.module
View file @
18eb0b67
...
...
@@ -15,7 +15,7 @@ function clientside_validation_form_after_build_recurse($form_id, &$form, &$form
foreach
(
$children
as
$index
=>
$item
)
{
$element
=
&
$form
[
$item
];
$types
=
array
(
'textfield'
,
'textarea'
,
'select'
,
'radio'
,
'checkbox'
,
'password'
,
'file'
,
'radios'
,
'checkboxes'
,
'textfield'
,
'textarea'
,
'select'
,
'radio'
,
'checkbox'
,
'password'
,
'managed_file'
,
'file'
,
'radios'
,
'checkboxes'
,
);
if
(
isset
(
$element
[
'#type'
])
&&
in_array
(
$element
[
'#type'
],
$types
))
{
clientside_validation_regular
(
$form_id
,
$element
,
$js_rules
);
...
...
@@ -42,6 +42,11 @@ function clientside_validation_regular($form_id, $element, &$js_rules) {
case
'password'
:
case
'textarea'
:
case
'file'
:
case
'managed_file'
:
if
(
$element
[
'#type'
]
==
'managed_file'
)
{
$el_name
=
$element
[
'upload'
][
'#name'
];
}
if
(
$is_multiple
)
{
// Only first field is required
if
(
!
isset
(
$multiples
[
$form_id
][
$el_name
]))
{
...
...
@@ -84,4 +89,4 @@ function clientside_validation_regular($form_id, $element, &$js_rules) {
break
;
}
}
}
\ No newline at end of file
}
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