Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tough Question: Preserving State in Dependent Drop Down Select List

Status
Not open for further replies.

wun1luv

Programmer
Jul 20, 2004
2
0
0
US
I have set up a demo of the problem I'm having at:
As you'll see on this page ... when you select a service, a dependent drop down list is called by a javascript function (included at bottom). However, as you'll notice, if you select one of the items from the dependent drop down list a new page refreshes. However, the selection made in the dependent list is not preserved.

How can I preserve this selection?

I really appreciate any help what-so-ever!!!


<script language="JavaScript">

var arItems = new Array()
arItems = [

[100, 100,'All'],
[98, 98,'All'],
[126, 126,'All'],
[127, 127,'All'],
[99, 99,'All'],
[123, 123,'All'],
[125, 125,'All'],
[124, 124,'All'],
[97, 97,'All'],
[121, 121,'All'],
[147, 147,'All'],

//all of the values are pulled from the database and written here...

]


function fillItems( intStart ) {

var fTypes = document.search.type1
var fItems = document.search.type1A
var a = arItems
var b, c, d, intItem, intType


if ( intStart > 0 ) {
for ( b = 0; b < a.length; b++ ) {
if ( a[1] == intStart ) {
intType = a[0];
}
}

for ( c = 0; c < fTypes.length; c++ ) {

if ( fTypes.options[ c ].value == intType ) {
fTypes.selectedIndex = c;
}
}
}

if ( intType == null ) {
intType = fTypes.options[ fTypes.selectedIndex ].value
}

fItems.options.length = 0;
for ( d = 0; d < a.length; d++ ) {
if ( a[d][0] == intType ) {
fItems.options[ fItems.options.length ] = new Option( a[d][2], a[d][1] ); // no line-break here
}


if ( a[d][1] == intStart ) {
fItems.selectedIndex = fItems.options.length - 1;
}
}
}

</script>

</select>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top