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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
| <html>
<head>
<title>Related menus</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<STYLE>
.saveHistory {behavior:url(#default#savehistory);}
</STYLE>
<SCRIPT LANGUAGE="JavaScript">
<!--
v=false;
//-->
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript1.1">
<!--
if (typeof(Option)+"" != "undefined") v=true;
//-->
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
<!--
if(v){a=new Array();}
function getFormNum (formName) {
var formNum =-1;
for (i=0;i<formNames.length;i++){
if (formName == formNames[i]) {
formNum = i;
break;
}
}
return formNum;
}
function jmp(form, elt)
// The first parameter is a reference to the form.
{
if (form != null) {
with (document.forms[form].elements[elt]) {
if (0 <= selectedIndex)
location = options[selectedIndex].value;
}
}
}
var catsIndex = -1;
var itemsIndex;
var subItemsIndex;
function newCat(){
catsIndex++;
a[catsIndex] = new Array();
itemsIndex = -1;
}
function soort(txt,url) {
itemsIndex++;
a[catsIndex][itemsIndex] = new Array();
a[catsIndex][itemsIndex].text = txt;
a[catsIndex][itemsIndex].value = url;
subItemsIndex = 0;
}
function optie(txt,url) {
a[catsIndex][itemsIndex][subItemsIndex] = new myOptions(txt,url);
subItemsIndex++;
}
function myOptions(txt,url){
this.text = txt;
this.value = url;
}
// array vullen
if (v) { // ns 2 fix
newCat();
soort("soort1","#");
optie("optie1","#");
optie("optie2","#");
optie("n.v.t.","#");
newCat();
soort("soort2","#");
optie("optie1","#");
optie("optie2","#");
optie("n.v.t.","#");
soort("soort3","#");
optie("optie1","#");
optie("optie2","#");
optie("n.v.t.","#");
soort("soort4","#");
optie("n.v.t.","#");
newCat();
var formNames = new Array('f1', 'f2', 'f3');
} // if (v)
function relate(formName,elementNum,j) {
// relate first to second (and third) menus
// ie change first menu, changes second, then change third
//
if(v){
var formNum = getFormNum(formName);
if (formNum>=0) {
formNum++; // reference next form, assume it follows in HTML
with (document.forms[formNames[formNum]].elements[elementNum]) {
for(i=options.length-1;i>0;i--) options[i] = null; // null out in reverse order (bug workarnd)
for(i=0;i<a[j].length;i++){
options[i] = new Option(a[j][i].text,a[j][i].value);
}
options[0].selected = true;
}
// change third menu
relate2(formName,elementNum,0,1);
}
} else {
jmp(formName,elementNum);
}
}
function relate2(formName,elementNum,j,fromRelate) {
if(v){
var formNum = getFormNum(formName);
if (formNum>=0) {
// find first menu's selection
// fromRelate means "coming from relate function?"
// then increment formNum so k refers to first form,
// not the nonexistent one before it (-1)
if (fromRelate) formNum++; // assumes forms follow each other
k = document.forms[formNames[formNum-1]].elements[elementNum].selectedIndex;
if(k<0)k=0; // precaution against missing selected in first menu list - abk
formNum++; // reference next form, assume it follows in HTML
with (document.forms[formNames[formNum]].elements[elementNum]) {
for(i=options.length-1;i>0;i--) options[i] = null; // null out in reverse order (bug workarnd)
for(i=0;i<a[k][j].length;i++){
options[i] = new Option(a[k][j][i].text,a[k][j][i].value);
}
options[0].selected = true;
}
}
} else {
jmp(formName,elementNum);
}
}
function IEsetup(){
if(!document.all) return;
IE5 = navigator.appVersion.indexOf("5.")!=-1;
if(!IE5) {
for (i=0;i<document.forms.length;i++) {
document.forms[i].reset();
}
}
}
window.onload = IEsetup;
//-->
</SCRIPT></head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr align="left" valign="top">
<FORM NAME="f1" METHOD="GET" ACTION="/cgi-bin/redirect.cgi" onSubmit="return false;">
<p>Form 1 met menu 1</p>
<p>
<SELECT NAME="m1" ID="m1" CLASS=saveHistory onChange="relate(this.form.name,0,this.selectedIndex)">
<option value="#">optie 1
<option value="#">optie 2
<option value="#">n.v.t.
</select>
<INPUT TYPE=SUBMIT VALUE="Go" onClick="jmp(this.form.name,0);">
</p>
</form>
<form action="form_submit.php" method="post" onsubmit="this.elements['field1'].value = document.forms['f1'].elements['m1'].value;">
<p>Form tussen related menus 1 en 2</p>
<p>
<input type="hidden" name="field1">
<input name="naam_soort" type="text" id="naam_soort">
</p>
<p>
<textarea name="omschrijving_soort" id="omschrijving_soort"></textarea>
</p>
<p>
<input name="Submit_soort" type="submit" id="Submit_soort" value="Toevoegen">
</p>
</form>
</td>
<td>
<FORM NAME="f2" METHOD="GET" ACTION="/cgi-bin/redirect.cgi" onSubmit="return false;">
<p>Form 2 met menu 2</p>
<p>
<SELECT NAME="m2" ID="m2" CLASS=saveHistory onChange="relate2(this.form.name,0,this.selectedIndex,0)">
<option value="#">soort 1
</select>
<INPUT TYPE=SUBMIT VALUE="Go" onClick="jmp(this.form.name,0);">
</p>
</form>
<FORM NAME="f3" METHOD="GET" ACTION="/cgi-bin/redirect.cgi" onSubmit="return false;">
<p>Form 3 met menu 3</p>
<p>
<SELECT NAME="m3" ID="m3" CLASS=saveHistory onChange="jmp(this.form.name,0)">
<option value="#">optie 1
<option value="#">optie 2
</select>
<INPUT TYPE=SUBMIT VALUE="Go" onClick="jmp(this.form.name,0);">
</p>
</form>
</td>
</tr>
</table>
</body>
</html> |