forked from binary-com/binary-static
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathform_validation.js
More file actions
44 lines (42 loc) · 1.27 KB
/
form_validation.js
File metadata and controls
44 lines (42 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//
//
//
// This script contains various functions used by our forms.
// NOTE: Since you might not find reference to these functions within our javascripts you might delete some stuff from here without cleaning up forms.
//
function clearInputErrorField(id) {
var errorfield = document.getElementById(id);
if (errorfield) {
// we need to create a brand new passage element and replace to the existing one.
// IE6 does not treat null/empty string as empty innerHTML (which means it will appear at the IE browswer)
var parentNode = errorfield.parentNode;
if (parentNode) {
var passage = document.createElement('p');
passage.id = errorfield.id;
passage.className = errorfield.className;
parentNode.replaceChild(passage, errorfield);
return passage;
}
return errorfield;
}
}
function swithTabIfError(IsErrorFound)
{
if (IsErrorFound)
{
$('.errorfield').each(function ()
{
if (this.innerHTML.length > 0)
{
MenuContent.trigger({
'content_id': $(this).parents('[id*=-content]').attr('id')
});
}
});
return 1;
}
else
{
return 0;
}
}