Advertisement

09.03.2008 at 12:26PM PDT, ID: 23700463 | Points: 500
[x]
Attachment Details

On submit clearing previous entries

Asked by flfmmqp in Active Server Pages (ASP), JavaScript

When I make a change to ddlDivision or to ddlMarket any entries I make to my text boxes(txtusername) gets cleared out along with my dropdownlist(ddlUserTitle).  How do I keep this from happening?Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
<%@ Language = VBScript %>
 
<%Option Explicit%>
 
<%Response.Buffer = True%>
 
<HTML>
 
<HEAD>
 
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
 
<TITLE></TITLE>
<%
dim strDataPath, strConnectString, objConnection
dim strDivision, strMarket, strCity, objRS, strSelected, strSQL
strDivision = Request.Form("ddlDivision")
strMarket = Request.Form("ddlMarket")
'set connection strings for entire application
strDataPath = server.MapPath("/Databases/CompEvents.mdb")
strConnectString = "Provider=Microsoft.Jet.OLEDB.4.0;"_
            + " Data Source= " & strDataPath & ";"_
            + " Mode=Share Deny None;User Id=admin;PASSWORD=;"
 
if not IsObject("ojbConnection") then
    set objConnection=Server.CreateObject("ADODB.Connection")
    objConnection.ConnectionTimeout = 15
    objConnection.CommandTimeout = 10
    objConnection.Mode = 3 'adModeReadWrite 
    if objConnection.state = 0 then
        objConnection.Open strConnectString
    end if
end if
 
sub makeDivision()
 
    if not isObject("objRS") then
        set objRS=Server.CreateObject("ADODB.RecordSet")
    end if
    if objRS.state <> 0 then
        objRS.close
    end if
    //strSQL = "SELECT Dmas.Division, Dmas.DMAID, Dmas.DMANAME FROM Dmas GROUP BY Dmas.Division, Dmas.DMAID, Dmas.DMANAME HAVING (((Dmas.Division)<>'MCF')) ORDER BY Dmas.Division;"
    strSQL = "SELECT DMAS.Division FROM DMAS GROUP BY DMAS.Division;"
    objRS.Open strSQL,objConnection,3,3
    Response.Write("<option></option>" & VBCRLF )
    do while not objRS.EOF
        if objRS("Division") = strDivision then
            strSelected = " Selected "
        else
            strSelected = ""
        end if
        Response.Write("<option" & strSelected & ">" &_
                 objRS("Division") & "</option>" & VBCRLF )
        objRS.MoveNext
    loop
    objRS.Close
    set objRS=Nothing
end sub
 
sub makeMarket()
    if strDivision <> "" then
        if not isObject("objRS") then
            set objRS=Server.CreateObject("ADODB.RecordSet")
        end if
        if objRS.state <> 0 then
            objRS.close
        end if
    //strSQL = "SELECT Dmas.Division, Dmas.DMAID, Dmas.DMANAME FROM Dmas GROUP BY Dmas.Division, Dmas.DMAID, Dmas.DMANAME HAVING (((Dmas.Division)<>'" & strDivision & "')) ORDER BY Dmas.DMANAME;"
    strSQL = "SELECT DMAS.DMANAME FROM DMAS WHERE (((DMAS.Division)='" & strDivision & "')) ORDER BY DMAS.DMANAME;"
 
        objRS.Open strSQL,objConnection,3,3
        if objRS.eof then
            Response.Write("<option>No Markets Found</option>")
        else
            Response.Write("<option>Select Market Now</option>" & VBCRLF )
            do while not objRS.EOF
                if objRS("DMANAME") = strMarket then
                    strSelected = " Selected "
                else
                    strSelected = ""
                end if
                Response.Write("<option" & strSelected & ">" &_
                         objRS("DMANAME") & "</option>" & VBCRLF )
                objRS.MoveNext
            loop
        end if
        objRS.Close
        set objRS=Nothing
    else
        Response.Write("<option>Select a Division First</option>")
    end if
end sub
%>
 
<SCRIPT LANGUAGE=javascript>
 
<!--
function submitDivision(){
    var objForm = document.forms[0];
    objForm.elements['ddlMarket'].selectedIndex=0;    
    objForm.submit();
}
 
function submitMarket(){
    var objForm = document.forms[0];
    objForm.submit();
}
 
//-->
</SCRIPT>
</HEAD>
<BODY onLoad="window.moveTo(0,0);window.resizeTo(400,400);">
 
<FORM action="" method=POST id=form1 name=form1 onSubmit="return submitForm()">
<SELECT name="ddlDivision" onChange="submitDivision()">
    <%call makeDivision%>
</SELECT><br>
 
<SELECT name="ddlMarket">
    <%call makeMarket%>
</SELECT>
    &nbsp;<br />
    <input id="txtusername" name="username" style="width: 164px; background-color: yellow"
        tabindex="0" type="text" />
    <br />
    <select id="ddlUserTitle" name="usertitle" onchange="CheckTitleStatus()" style="width: 170px;
        background-color: yellow" tabindex="1">
        <option selected="selected" value="0">-- Select Title --</option>
        <option value="GM">GM</option>
        <option value="Div Mgmt">Div Mgmt</option>
        <option value="Regional">RVP</option>
        <option value="Real Estate">Real Estate</option>
        <option value="AR">A/R</option>
    </select>
    <br />
    <input id="Submit1" type="submit" value="submit" />
</FORM>
</BODY>
<%
objConnection.Close
set objConnection = Nothing
%>
</HTML>
[+][-]09.03.2008 at 12:38PM PDT, ID: 22381094

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.03.2008 at 12:50PM PDT, ID: 22381206

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.03.2008 at 12:53PM PDT, ID: 22381225

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.03.2008 at 01:01PM PDT, ID: 22381322

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.04.2008 at 06:30AM PDT, ID: 22386981

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.04.2008 at 06:48AM PDT, ID: 22387211

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.04.2008 at 07:17AM PDT, ID: 22387600

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.04.2008 at 07:19AM PDT, ID: 22387635

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.04.2008 at 07:48AM PDT, ID: 22387987

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.04.2008 at 08:29AM PDT, ID: 22388656

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-43 / EE_QW_2_20070628