Hello List!

I'm having a little problem w/ getting my select box populated...

I'm passing in a 'LocationID' to this page and need to write a function to take that LocationID and populate the select box when the page is loaded.

Here's my onload:

<body topmargin="0" leftmargin="0" onunload="Javascript:closeWindows();" onload="loadTopSVGVariables(document.forms[0].LocationID);loadBottomLocationID(document.forms[0].LocationID);">

And the function I'm trying to get working:

function loadBottomLocationID(LocationID){
   if ( LocationID != null ){
      document.forms[0].LocationID = new Option(LocationID);

So, what I want is to get the LocationID that is being passed in, and populate this value in the select box on the page...

Any help or assistance you could provide would be greatly appreciated!

Thanks in advance for your time and help!

I should probably also post my code for my select box:

  <td ID="MultipleSearch">
    <select name="LocationID" multiple="true" size="25" Width="200">
        if IsArray(arrLocs) then
							bSelectOptions = true
	for i = 0 to UBound(arrLocs, 2)
	  Response.Write "<option value=""" & arrLocs(0,i) & """>" & arrLocs(1,i) & "</option>"
        end if


Thanks for the reply!

I think I'm getting closer...

When I use this:

function loadBottomLocationID(locationID){
  var txt = "TEST";
  document.form1.LocationID.options[0] = new Option(txt);
  return true;

The string "TEST" is showing up in my select box; however, if I set

var txt = locationId;

Nothing is showing up in the select box....


Thanks again for your help!

What do you actually mean here? :

var txt = locationId;

Because it is going to be undefined in your code. It should probably be given a string value or you need to set locationId before you use it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.