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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo Box and Session Variable

Status
Not open for further replies.

egolds

MIS
Aug 29, 2001
105
US
I have a problem that involves ASP and JavaScript so I am posting this in both places. I have a page that uses an array called by a function to populate a drop down in a form. Listed below are 1) the array, 2) the function calling, and 3) the function with the parameters.

I am modifying this (I did not write it) so that I can persist data as I move through a series of pages. The information is being stored in an ASP Session variable Session("State"). How can I call the session variable to replace the 00,(Make Selection) in the array so it becomes the selected item when I return to the page so that the user does not loose the selection when they come back to the page? I know this is mostly a Javascript question but if any of you can provide assistance it would be greately appreciated.

1)
var StateArray = new Array();
StateArray[StateArray.length] = new SetCode("00", "(Make Selection)");
StateArray[StateArray.length] = new SetCode("AK", "Alaska");
StateArray[StateArray.length] = new SetCode("AL", "Alabama");

2)
function LoadCodes(ComboList, CodeArray)
{
for (i=0; i < CodeArray.length; i++)
{
ComboList.options = new Option(CodeArray.Description);
ComboList.options.value = CodeArray.Code;
}
ComboList.options[0].selected = true;
}

3)
function LoadBody()
{
LoadCodes(document.Pers.STATE, StateArray);
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top