aturner51
03-05-2003, 12:26 PM
I have written an ASP form that has ten drop down list box, 15 textboxes and two textarea, which is populated using MS SQL stored procedure. When the page is accessed through the browser, the list box has the values already in it.
The user is required to first search the database using a 9-digit number, that retrieves data that may currently be in the database. If the 9-digit number exist and the user has not entered any data, they will be required to fill out the form by selecting the values in the listbox and enter data in the empty text fields. The problem I'm having is with the listbox. I have added a checkbox next to each listbox that allows the user to change the value when necessary. However, if there are more than one listbox that needs to be updated by the user, when they change one listbox by placing a check in the checkbox next to it, and needs to select a second listbox to change by placing a check in another checkbox, it removes the value in the first listbox as if the refresh button once pressed. Here is the syntax below:
<%
If CustodyID = "" or CustodyEdit = 1 Then
Set objDBCmd = Server.CreateObject("ADODB.Command")
With objDBCmd
.ActiveConnection = objDB
.CommandType = adCmdStoredProc
.CommandText = "spCustodyList"
End With
Set objRS = objDBCmd.Execute
Set objDBCmd = Nothing
End If
%>
<font size="2" face="verdana" color="#006563"> Custody: </font><select id="cboCustody" name="CustodyID">
<option></option>
<% If CustodyID = "" or CustodyEdit = 1 Then %>
<%Do While Not objRS.EOF%>
<option value="<%=objRS("CustodyID")%>"><%=objRS("Custody")%>
<%
objRS.MoveNext
Loop
objRS.Close
Set objRS = Nothing
%>
</select><font size="2">
<% Else %>
<option value="<%=CustodyID%>" selected><%=CustodyDesc%>
</select><font size="2" color="#990033">
<input type="checkbox" name="CustodyEdit" value="1" onclick="document.form2.submit()"> <font size="2">Edit</font>
<% End If %>
The same syntax above is used for all listboxes on the form.
Can you tell me how to get around this in my form?
The user is required to first search the database using a 9-digit number, that retrieves data that may currently be in the database. If the 9-digit number exist and the user has not entered any data, they will be required to fill out the form by selecting the values in the listbox and enter data in the empty text fields. The problem I'm having is with the listbox. I have added a checkbox next to each listbox that allows the user to change the value when necessary. However, if there are more than one listbox that needs to be updated by the user, when they change one listbox by placing a check in the checkbox next to it, and needs to select a second listbox to change by placing a check in another checkbox, it removes the value in the first listbox as if the refresh button once pressed. Here is the syntax below:
<%
If CustodyID = "" or CustodyEdit = 1 Then
Set objDBCmd = Server.CreateObject("ADODB.Command")
With objDBCmd
.ActiveConnection = objDB
.CommandType = adCmdStoredProc
.CommandText = "spCustodyList"
End With
Set objRS = objDBCmd.Execute
Set objDBCmd = Nothing
End If
%>
<font size="2" face="verdana" color="#006563"> Custody: </font><select id="cboCustody" name="CustodyID">
<option></option>
<% If CustodyID = "" or CustodyEdit = 1 Then %>
<%Do While Not objRS.EOF%>
<option value="<%=objRS("CustodyID")%>"><%=objRS("Custody")%>
<%
objRS.MoveNext
Loop
objRS.Close
Set objRS = Nothing
%>
</select><font size="2">
<% Else %>
<option value="<%=CustodyID%>" selected><%=CustodyDesc%>
</select><font size="2" color="#990033">
<input type="checkbox" name="CustodyEdit" value="1" onclick="document.form2.submit()"> <font size="2">Edit</font>
<% End If %>
The same syntax above is used for all listboxes on the form.
Can you tell me how to get around this in my form?