mc_chkFormular.inc.js
5.36 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
var var_preInputName;
var var_toCheck = new Array();
var var_valueCheck = new Array();
function fnc_setPreInputName(param_value) {
var_preInputName = param_value;
}
function fnc_setCheckFormular(param_name, param_value) {
if(param_name){
var_toCheck.push(param_name);
var_valueCheck.push(param_value);
}
}
function fnc_mkAlert(param_kind, param_value) {
if(param_kind){
if(param_kind == 'Url')
alert('<p class="noticeIcon"> </p>'+obj_lang['alertTopUncomplete'],'<span class="bold">'+param_value +'</span> '+obj_lang['alertUrl']);
else if(param_kind == 'EMail')
alert('<p class="noticeIcon"> </p>'+obj_lang['alertTopUncomplete'],'<span class="bold">'+param_value +'</span> '+obj_lang['alertEmail']);
else if(param_kind == 'Name' || param_kind == 'NickName')
alert('<p class="noticeIcon"> </p>'+obj_lang['alertTopValue'],'<span class="bold">'+param_value +'</span> '+obj_lang['alertName']);
else if(param_kind == 'Search')
alert('<p class="noticeIcon"> </p>'+obj_lang['alertTopSearch'],'<span class="bold">'+param_value +'</span> '+obj_lang['alertSearch']);
}
else
alert('<p class="noticeIcon"> </p>'+obj_lang['alertTopUncomplete'],'<span style="color:red;">*</span> '+obj_lang['alertBound']);
}
function fnc_chkSearchFormular() {
if(window.document.getElementById("searchValue").value == "" || !window.document.getElementById("searchValue").value.match(/^[\w\-]+$/)){
window.document.getElementById("searchValue").focus();
fnc_mkAlert('Search',window.document.getElementById("searchValue").value);
window.document.getElementById("searchValue").focus();
return false;
}
return true;
}
function chkFormular () {
for(index = var_toCheck.length - 1; index >=0; index-- ){
if(var_toCheck[index] != 'Start' && var_valueCheck[index] == ""){
if(var_toCheck[index] != 'Link'){
if(window.document.getElementsByName(var_preInputName + "[" + var_toCheck[index] + "]")[0].value == ""){
window.document.getElementsByName(var_preInputName + "[" + var_toCheck[index] + "]")[0].focus();
fnc_mkAlert();
window.document.getElementsByName(var_preInputName + "[" + var_toCheck[index] + "]")[0].focus();
return false;
}
}
else{
if(window.document.getElementsByName("0")[0].value == "" && window.document.getElementsByName("[old_file]")[0].value == ""){
window.document.getElementsByName("0")[0].focus();
fnc_mkAlert();
window.document.getElementsByName("0")[0].focus();
return false;
}
}
}
}
if(window.document.getElementsByName(var_preInputName + "[Url]" )){
for(index = window.document.getElementsByName(var_preInputName + "[Url]" ).length - 1; index >=0; index-- ){
if(window.document.getElementsByName(var_preInputName + "[Url]" )[index].value !="" && !window.document.getElementsByName(var_preInputName + "[Url]" )[index].value.match(/^((http|https)\:\/\/){1}([\w\-\/\.\[\]\&\?\=\,])+$/)){
window.document.getElementsByName(var_preInputName + "[Url]" )[index].focus();
fnc_mkAlert('Url', window.document.getElementsByName(var_preInputName + "[Url]" )[index].value);
window.document.getElementsByName(var_preInputName + "[Url]" )[index].focus();
return false;
}
}
}
if(window.document.getElementsByName(var_preInputName + "[EMail]" )){
for(index = window.document.getElementsByName(var_preInputName + "[EMail]" ).length - 1; index >=0; index-- ){
if(window.document.getElementsByName(var_preInputName + "[EMail]" )[index].value !="" && !window.document.getElementsByName(var_preInputName + "[EMail]" )[index].value.match(/^[_\.A-Za-z0-9\-]+@([A-Za-z0-9\-]+\.)+[a-z]{2,4}$/)){
window.document.getElementsByName(var_preInputName + "[EMail]" )[index].focus();
fnc_mkAlert('EMail', window.document.getElementsByName(var_preInputName + "[EMail]" )[index].value);
window.document.getElementsByName(var_preInputName + "[EMail]" )[index].focus();
return false;
}
}
}
if(window.document.getElementsByName(var_preInputName + "[Name]" ).length > 0){
if(window.document.getElementsByName(var_preInputName + "[Name]" )[0].value !="" && !window.document.getElementsByName(var_preInputName + "[Name]" )[0].value.match(/^[\w\-]+$/)){
window.document.getElementsByName(var_preInputName + "[Name]" )[0].focus();
fnc_mkAlert('Name', window.document.getElementsByName(var_preInputName + "[Name]" )[0].value);
window.document.getElementsByName(var_preInputName + "[Name]" )[0].focus();
return false;
}
}
if(window.document.getElementsByName(var_preInputName + "[NickName]" ).length > 0){
if(window.document.getElementsByName(var_preInputName + "[NickName]" )[0].value !="" && !window.document.getElementsByName(var_preInputName + "[NickName]" )[0].value.match(/^[\w\-]+$/)){
window.document.getElementsByName(var_preInputName + "[NickName]" )[0].focus();
fnc_mkAlert('NickName', window.document.getElementsByName(var_preInputName + "[NickName]" )[0].value);
window.document.getElementsByName(var_preInputName + "[NickName]" )[0].focus();
return false;
}
}
if(window.document.getElementsByName(var_preInputName + "[Delete]")[0]){
if(window.document.getElementsByName(var_preInputName + "[Delete]")[0].checked){
Check = confirm(obj_lang['checkDelete']);
if(!Check)
return false;
}
}
}
function chkRemove(param_lang){
Check = confirm(obj_lang['checkRemove'+param_lang]);
if(!Check)
return false;
}
function chkDelete(){
Check = confirm(obj_lang['checkDelete']);
if(!Check)
return false;
}