On my website, I have set up a dedicated page for testing the functions I have developed, totaling around 30 to 40 so far. I have implemented a drop-down menu to list out these functions by name. When a function is selected, I trigger it using onChange with "window.location" and a Select Case structure. I pass the index through the query string using this.selectedIndex in the onChange event. This method was working perfectly until I realized I also needed to capture the value of the selected option (the name of the function being tested), not just the index value. However, I discovered that window.location does not send form values back, rendering them unavailable. I tried using "location.reload" to post back the data, but that did not solve the issue.
After some research, I attempted to pass the option value data via the query string by using "this.selectedOptions", but unfortunately, that did not work either. I have included a snippet of the code below, which functions correctly, but I am unable to retrieve the text value of the selected option.
<form action="testcodepage.asp" method="post">
<select class="rounded " name="cboSearchCategories "
onChange='window.location="<%=sRootDomain%>/testcode/template/testcodepage.asp?TestCategory=" + this.selectedIndex;'
<option value="Select One">Select One</option>
<option value="SearchEquipmentDB()">SearchEquipmentDB()-Case #1</option>
<option value="DisplaySingleItem()">DisplaySingleItem()-Case #2</option>
<option value="CreateJSONSchema()">CreateJSONSchema()-Case #3</option>
<option value="UnlockChilkatAPI()">UnlockChilkatAPI()-Case #4</option>
</select>
</form>
If there is a way to make this work without using a submit button, I would greatly appreciate any help! It's worth noting that this code is written in ASP Classic, but the solution would be relevant for any form submission method.