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

Storing Value From A Combo Box

Status
Not open for further replies.

FontanaS

Programmer
May 1, 2001
357
US
I have the following code that creates a combo box and retrieves the values for that combo box from another table in the database.

<!--CREATE TEXT BOX SO USER CAN EDIT APPROP FUNDING TYPE-->
<td align="center">
<%
'RETRIEVE ALL RECORDS IN THE AGENCY TABLE
Cmd="SELECT FundingType FROM Tbl_Funding_Type ORDER BY FundingType"
'EXECUTE THE SQL COMMAND
SET RsFundingCombo=AAR400PRPdb.execute(Cmd)
%>
<select name="ComboFundingType" onChange="onChange()">
<%
DO WHILE NOT RsFundingCombo.eof
%>
<option value="<%=RsFundingCombo.Fields("FundingType")%>" name="<%Trim(RsFundingCombo.Fields("FundingType"))%>"><%=Trim(RsFundingCombo.Fields("FundingType"))%>
<%
RsFundingCombo.movenext
LOOP
%>
</select></td>

The next section of code is the java script i use to store the value the user chose -

<!--THIS SECTION IS TO STORE THE VALUE CHOSEN FROM THE DROP DOWN MENU-->
<script language="JavaScript"><!--
function onChange() {
var Current = document.appropriationform.ComboFundingType.selectedIndex;
document.appropriationform.currentText3.value = document.appropriationform.ComboFundingType.options[Current].text;
}//--></script>
<!--THIS IS THE END OF THE SECTION OF THE VALUE CHOSEN FROM THE DROP DOWN MENU-->

The problem is that I want the value chosen from the drop down menu to be stored in a variable, not a text box on the form like it has in the code. I have tried substittuting the "document.appropriationform.currentText3.value" with a variable name "ex- lvTest" but it does not work. any suggestions? I asm not that familiar with JAVA.

THANKS!
 
I don't what lanaguage that is (maybe ASP ?) but it is certainly not Java. Also, why did you post the same question in the ASP forum if you know that it is ASP ? thread333-981062

Click here to learn Ways to help with Tsunami Relief
--------------------------------------------------
Free Database Connection Pooling Software
 
I thought it was java code. i will try to find the appropriate forum to post the question. i posted a different question in the asp forum that had to do with the asp part of the code i listed. thanks anyway!

 
It is ASP (I used to do this stuff [evil]) with some JavaScript in the generated page. Isn't there a forum specially for Javascript too?
 
there is forum called javascript. for some reason i couldn
t find it at first. thanks. i will post my question there.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top