Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: VBScript Function to Add Multiple Select Contents from List Box


Message #1 by "Rita Greenberg" <rg1@h...> on Fri, 23 Mar 2001 22:27:08
Hi.



I have an ASP page with 2 list boxes. The first list box is populated with 

information from a data base. The user is allowed to select multiple rows 

from the list box. I have a button that when they click on it, the 

selection they made will be inserted into the second list box. 



I have a "onclick" event that calls the vbscript function. I'm at a loss 

as to what the code in the function should look like. I found some 

JavaScript example but I have to use vbscript.



Here's my <SELECT> statement:

<select id='oGroups' name='oGroups' size='8' multiple style='width: 260px'>



Here's my button:

Response.Write ("<input id='AddButton' type='button' value='Add>>' 

name='Add' style='width: 6em; height: 24px' onclick='addtolist()'><br>")



(The > = >, so the value='Add>>')



I have a function as follows:

<script language="VBScript">

function addtolist()

	Dim i

	For i = 1 to oGroups.options.length

            'I need to know what goes here!!! 

            'and there's a problem with the "For i" line

	Next

end function

</script>



I get an error message "Error: Object required 'oGroups'.



Help!!



TIA,



Rita

  Return to Index