Forum Moderators: open

Message Too Old, No Replies

selective memory

Selected = last

         

Stuperfied

11:44 am on Apr 26, 2005 (gmt 0)

10+ Year Member



Hi,

Im making a control panel where users can pick:
Table "Containers"
Field "name"
Field "value"

Table "Objects"
Field "name"
Field "value"

Users can specify custom names, values and number of rows for both tables. I have a page that lists the containers with the objects available to put into them. A text field displays the name field from the containers table and a select menu displays the name field from the objects table with the repeat behaviour applied to both. When a name from the objects select menu is chosen, its value is saved in the corresponding value field of the containers table.

Since the user can specify custom lables for the containers and objects, I must use a dynamic select menu. The problem I am having is getting the select menu to specify the current object in use for each container as the initially selected value of the select menu, which is equal to the corresponding value field of the containers table.

Does anyone know how to do this?

Stuperfied

1:30 pm on Apr 26, 2005 (gmt 0)

10+ Year Member



Thanks anyway but with a little persistance I seem to have been able to get it working. Code spam for anyone else who gets into a similar problem.

<form name="form1" method="post" action="">
<table width="400" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>Container</b></td>
<td><b>Object</b></td>
</tr>
<%
While ((Repeat1__numRows <> 0) AND (NOT rsContainers.EOF))
%>
<tr>
<td width="109"><input name="name" type="text" id="name" value="<%=(rsContainers.Fields.Item("name").Value)%>" size="20" maxlength="20">
</td>
<td width="144"><select name="name" id="name">
<%
While (NOT rsObjects.EOF)
%>
<option value="<%=(rsObjects.Fields.Item("value").Value)%>" <%If (InStr(1,(rsContainers.Fields.Item("value").Value),(rsObjects.Fields.Item("name").Value))>=1) Then Response.Write("SELECTED")%>><%=(rsObjects.Fields.Item("name").Value)%></option>
<%
rsObjects.MoveNext()
Wend
If (rsObjects.CursorType > 0) Then
rsObjects.MoveFirst
Else
rsObjects.Requery
End If
%>
</select> </td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsContainers.MoveNext()
Wend
%>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
</table>
</form>