
March 27th, 2003, 08:14 AM
|
|
Junior Member
|
|
Join Date: Mar 2003
Posts: 6
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Thanks, I was able to figure it out and I'll share it with you;
First, on the form page I put in a function to open a new window(found this on the web and changed appropriately)
<SCRIPT LANGUAGE="JavaScript">
function newWindow(file,window) {
msgWindow=open(file,window,'resizable=no,Toolbar=no, menubar=no, status=yes, scrollbars=yes, height=400, width=600, left=50, Top=50');
if (msgWindow.opener == null) msgWindow.opener = self;
}
</script>
Then created an text input element so I would have someplace to put the chosen value(s).
<input name="TOE" type="text" value="Click Button to select" READONLY size="20" tabindex="5">
And a button in which to open the pop-up page;
<TD align="center" colspan="1" bgcolor="#D3D3D3"><input type="button" value="Type of Entry" onClick="newWindow('toe3.asp','window2')">
</TD>
Then, the pop-up page
First, a function to update the main form page (found on the web and changed accordingly)
<SCRIPT LANGUAGE="JavaScript">
<!--
function update() {
var output = '';
for (var i=0;i < document.forms[0].selectfield.options.length;i++) {
if (document.forms[0].selectfield.options[i].selected) {
output += document.forms[0].selectfield.options[i].value + ' ';
}
}
opener.document.forms[0].TOE.value = output;
window.close();
}
-->
</SCRIPT>
ADO Connection
<%
set rsTOE = Server.CreateObject("adodb.Recordset")
%>
Then, a table to hold a drop down select dynamically generated using vbscript and ASP;
<form onSubmit="return false">
<Table Border="0" Bordercolor="#000000" cellpadding="1" cellspacing="2" cols="4" width="55%">
<TR>
<TD align="left" colspan="1">
<%
sql="Select * From tblTOE Order By TOEID ASC"
rsTOE.Open sql, con
' Loop through recordset and display results
If Not rsTOE.EOF Then
rsTOE.MoveFirst
' the form below calls this file only this time with an id in the QueryString
%>
<SELECT NAME="selectfield" size=10 MULTIPLE tabindex="5">
<Option Value="" Selected></Option>
<%
' Continue until we get to the end of the recordset.
Do While Not rsTOE.EOF
' For each record we create a option tag and set it's value to the TOE ID
' The text we set to the TOE text
%>
<OPTION VALUE="<%= rsTOE.Fields("TOEID") %>"><%= rsTOE.Fields("TOE") %></OPTION>
<%
' Get next record
rsTOE.MoveNext
Loop
%>
</SELECT>
<%
End If
rsTOE.close
Set rsTOE = Nothing
%>
</TD>
<TD>
<%
Response.Write "<Center><Font Face='Lucida' Size='4' Color='#FFFFFF'>For Multiple Selections</Font></Center>"
Response.Write "<Center><Font Face='Lucida' Size='4' Color='#FFFFFF'>press CTRL key, click on each</Font></Center>"
Response.Write "<Center><Font Face='Lucida' Size='4' Color='#FFFFFF'>selection using left mouse button.</Font></Center>"
%>
</TD>
</TR>
</table>
</body>
</html>
Thanks for your suggestion, I will try it out. There is always something new to learn in this business.
|