Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

VB Script - Changing contents of 2nd dropdown based on 1st dropdown selection

$
0
0

I am writing some vb for an hta script. The code I have for the one dropdown is below. I basically need to have 2 dropdowns. The first needs to show 5 different businesses. The 2nd dropdown's contents should be populated once the first dropdown (business) is selected. The 2nd dropdown will include all of the different locations for that business that was selected in the first dropdown. I am not sure how to populate the contents of the 2nd dropdown based on the 1st dropdown selection. Can someone help me?

<SCRIPT LANGUAGE='VBSCRIPT'>
		ON ERROR RESUME NEXT
		'DEFINE OBJECTS--------------------------------------------------------
		Set oFSO = CreateObject("Scripting.FileSystemObject")
		Set objShell = CreateObject("Wscript.Shell")
		Set objWMIService = GetObject("winmgmts:\\.\root\CIMV2")
		'DEFINE VARIABLES------------------------------------------------------
		Const ForAppending = 8
		Const ForWriting = 2
		Looper = 1
		STAGE = 1
		LASTSTAGE = 0
		currentlocation = "0"
		count_tablets = "0"
		DIM locationindex,tabletsindex,wstationsindex,desktopsindex,laptopsindex,count_laptops,count_desktops,count_wstations,tablets(5),tablettypeindex(5)
		DIM isPrimary,isS2Owned,conferenceroompc,username,hostname,ipaddress,make,model,os,bit,serial


		Function startSTAGE2()
			ON ERROR RESUME NEXT
			LASTSTAGE = STAGE
			bodystring = "Select your current location: <SELECT SIZE='1' NAME='Clocation' ONCHANGE='LOCCHANGED()'>"
			bodystring = bodystring & "<option value='0'>&nbsp;</option>"
			bodystring = bodystring & "<option value='Albertville, AL'"
			If locationindex = 1 Then bodystring = bodystring & " selected"
			bodystring = bodystring & ">Albertville, AL</option><option value='Annville, KY'"
			If locationindex = 2 Then bodystring = bodystring & " selected"
			bodystring = bodystring & ">Annville, KY</option><option value='Bath, ME'"
			If locationindex = 3 Then bodystring = bodystring & " selected"
			bodystring = bodystring & ">Bath, ME</option><option value='California, MD'"
			If locationindex = 4 Then bodystring = bodystring & " selected"
			bodystring = bodystring & ">California, MD</option><option value='Charleston, SC'"
			If locationindex = 5 Then bodystring = bodystring & " selected"
			bodystring = bodystring & ">Charleston, SC</option><option value='Chesapeake, VA'"
			If locationindex = 6 Then bodystring = bodystring & " selected"
			bodystring = bodystring & ">Chesapeake, VA</option><option value='Colorado Springs'"
			If locationindex = 7 Then bodystring = bodystring & " selected"
			bodystring = bodystring & ">Colorado Springs, CO</option><option value='Crestview, FL'"
			If locationindex = 8 Then bodystring = bodystring & " selected"
			bodystring = bodystring & ">Crestview, FL</option><option value='Dayton, OH'"
			If locationindex = 9 Then bodystring = bodystring & " selected"
			bodystring = bodystring & ">Dayton, OH</option><option value='Falcon Hill AFB, UT'"
			If locationindex = 10 Then bodystring = bodystring & " selected"
			bodystring = bodystring & ">Falcon Hill AFB, UT</option></SELECT>"



		Function LOCCHANGED()
			ON ERROR RESUME NEXT
			currentlocation = Clocation(Clocation.selectedIndex).Value
			locationindex = Clocation.selectedIndex
		End Function



Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>