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

Wrong code previously

Status
Not open for further replies.

HardHat

IS-IT--Management
Aug 7, 2003
14
US
Sorry, Just checked, I posted the wrong code for my question.

I have JS code that creates 2 dynamic dropdown lists, the second dependant on the first. What I need to be able to do is keep any text that is filled in on the form before the pulldown lists are changed. Is there a way of doing this ?

The code I have so far is :

<%@ Language = VBScript %>
<%Option Explicit%>
<%Response.Buffer = True%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
<!-- #INCLUDE FILE="../../../../Scripts/GetDatabase.asp" -->
<%
dim strDataPath, strConnectString, objConnection, stredition, stredlist, strCity, objRS, strSelected

stredlist = Request.Form("edlist")
stredition = Request.Form("edition")

DBConnect("adtracking.mdb")

'set connection strings for entire application



sub makeedlist()
Dim strSQLedlist, RSedlist

Dim strRecordsproduct

Set RSedlist = Server.CreateObject("ADODB.Recordset")

strSQLedlist = "Select edlist from edlist order by edlist_id"
RSedlist.Open strSQLedlist, DB

Response.Write("<option></option>" & VBCRLF )
do while not RSedlist.EOF
if RSedlist("edlist") = stredlist then
strSelected = " Selected "
else
strSelected = ""
end if
Response.Write("<option" & strSelected & ">" & RSedlist("edlist") & "</option>" & VBCRLF )
RSedlist.MoveNext
loop
RSedlist.Close
set RSedlist=Nothing
end sub






sub makeedition()




Dim strSQLedition, RSedition



Set RSedition = Server.CreateObject("ADODB.Recordset")

strSQLedition = "Select editions from editions WHERE usedfor = '" & stredlist & "'order by unique"
RSedition.Open strSQLedition, DB
if RSedition.eof then
Response.Write("<option>No editions Found</option>")
else
Response.Write("<option>Select Edition Now</option>" & VBCRLF )
do while not RSedition.EOF
if RSedition("editions") = stredition then
strSelected = " Selected "
else
strSelected = ""
end if
Response.Write("<option" & strSelected & ">" & RSedition("editions") & "</option>" & VBCRLF )
RSedition.MoveNext
loop
end if
RSedition.Close
set RSedition=Nothing

end sub
%>

<SCRIPT LANGUAGE=javascript>
<!--

function submitedlist(){
var objForm = document.forms[0];
objForm.elements['edition'].selectedIndex = 0;
objForm.submit();
}
function submitEdition(){
var objForm = document.forms[0];
objForm.elements['edlist'].selectedIndex = 0;
objForm.submit();
}

function submitForm(){
var objForm = document.forms[0];
objForm.action = " return true;
}
//-->
</SCRIPT>

</HEAD>
<BODY>
<FORM action="" method=POST id=form1 name=form1 onSubmit="return submitForm()">
<SELECT name="edlist" onChange="submitedlist()">
<%call makeedlist%>
</SELECT><br>
<SELECT name="edition">
<%call makeedition%>
</SELECT><br>

<p><INPUT type="submit" value="Submit" id=submit1 name=submit1></p>
</FORM>
</BODY>


</HTML>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top