Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
drupal.org
clientside_validation
Commits
c067999a
Commit
c067999a
authored
Nov 19, 2013
by
jelles
Browse files
Issue #2036153 by doronsever: How to use equals to another field progrmatically.
parent
fd2ffb7d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
3 deletions
+9
-3
clientside_validation.module
clientside_validation.module
+6
-3
clientside_validation_fapi/clientside_validation_fapi.module
clientside_validation_fapi/clientside_validation_fapi.module
+3
-0
No files found.
clientside_validation.module
View file @
c067999a
...
...
@@ -933,13 +933,16 @@ function _clientside_validation_set_equal($name, $title, $value, &$js_rules, $me
if
(
$webform
)
{
$js_rules
[
$name
][
'equalTo'
]
=
':input[name=\'submitted['
.
$value
[
'form_key'
]
.
']\']'
;
}
else
{
else
if
(
is_array
(
$value
))
{
$js_rules
[
$name
][
'equalTo'
]
=
':input[name=\''
.
$value
[
'element_name'
]
.
'\']'
;
}
else
{
$js_rules
[
$name
][
'equalTo'
]
=
':input[name=\''
.
$value
.
'\']'
;
}
if
(
empty
(
$message
))
{
$variables
=
array
(
'message'
=>
'!title field has to be equal to !firstone.'
,
'placeholders'
=>
array
(
'!title'
=>
$title
,
'!firstone'
=>
$value
[
'name'
]),
'message'
=>
is_array
(
$value
)
?
'!title field has to be equal to !firstone.'
:
'Field values must match'
,
'placeholders'
=>
is_array
(
$value
)
?
array
(
'!title'
=>
$title
,
'!firstone'
=>
$value
[
'name'
])
:
array
()
,
'error_type'
=>
'equalto'
,
'element_name'
=>
$name
,
);
...
...
clientside_validation_fapi/clientside_validation_fapi.module
View file @
c067999a
...
...
@@ -147,6 +147,9 @@ function _clientside_validation_set_fapi_validation($element, $rule, $params, &$
}
_clientside_validation_set_regex_pcre
(
$name
,
$title
,
$js_rules
,
$expression
,
$message
,
'decimal'
);
break
;
case
'fapi_validation_rule_match_field'
;
_clientside_validation_set_equal
(
$name
,
$title
,
$params
[
0
],
$js_rules
);
break
;
default
:
$context
=
array
(
'type'
=>
'fapi'
,
'rule'
=>
$rule
,
'message'
=>
$message
,
'params'
=>
$params
);
drupal_alter
(
'clientside_validation_rule'
,
$js_rules
,
$element
,
$context
);
...
...
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