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

Displaying recordsets on demand within HTML forms

Status
Not open for further replies.

Paul69

Programmer
Jan 16, 2001
1
CA
Hello Everyone,
I am new here and am struggling a bit with an ASP project.
Using a simple Access backend, I am trying to pull records from a single table and display them in 3 different HTML forms on the same web page. The first form is a listbox, which displays a single row of data, the second form is a textarea which displays the comments (a memo field in the table) and the last form is also a text area, displaying the contents of another memo field in the Access table.
Basically, a user will log into the site with a username/password; their session ID is then read into the page in question, and it only then displays their records in the database, as opposed to giving them access to everyone's records. I have been able to do this much, using a simple SQL statement. What I am having trouble with is getting the page to display thier records one row at a time into the forms. I was hoping to use a form with a submit button, and have it pull the next row in the table, in sequence, and paste the records into the appropriate HTML forms, clearing out the previous. In other words, having it cycle through their records with each click of the button.
I am not sure if this is possible using Javascript with an onClick event or an onChange event, as I didn't think it was possible to have a client-side script interact with the database.
I will post the code for that page here:
_______________________________________________________
<!--#include file=&quot;clssfd.asp&quot;-->
<%
If Session(&quot;PersonID&quot;) = &quot;&quot; then
Response.Redirect &quot;login.asp&quot;
End if

Dim aName
aName = Session(&quot;Name&quot;)

%>

<Script Language=JavaScript>
function closeWindow() {
window.close()
}
</Script>
<BASEFONT FACE=&quot;Verdana&quot; COLOR=&quot;Black&quot;>
<HTML>

<HEAD>
<TITLE>eSupport Review Tool</TITLE>

</HEAD>

<BODY text=&quot;#00008b&quot; topmargin=&quot;0&quot; leftmargin=&quot;0&quot;>



<table border=&quot;0&quot; cellPadding=&quot;0&quot; cellSpacing=&quot;0&quot; width=&quot;100%&quot;>
<tr>
<td width=&quot;20&quot;></td>
<td align=&quot;left&quot;></td>
<td vAlign=&quot;bottom&quot; width=&quot;1&quot;></td>
<td vAlign=&quot;bottom&quot; width=&quot;1&quot;></td>
</tr>
</table>
<table border=&quot;0&quot; cellPadding=&quot;0&quot; cellSpacing=&quot;0&quot; height=&quot;14&quot; width=&quot;100%&quot;>
<tr>
<td bgColor=&quot;#000000&quot; width=&quot;20&quot;>&amp;nbsp;</td>
<td bgColor=&quot;#000000&quot; height=&quot;14&quot; width=&quot;79&quot;>&amp;nbsp;</td>
<td bgColor=&quot;#000000&quot; width=&quot;50&quot;>&amp;nbsp;</td>
<td align=&quot;middle&quot; bgColor=&quot;#000000&quot; height=&quot;14&quot; width=&quot;60&quot;></td>
<td align=&quot;middle&quot; bgColor=&quot;#000000&quot; height=&quot;14&quot; width=&quot;98&quot;>&amp;nbsp;</td>
<td align=&quot;middle&quot; bgColor=&quot;#000000&quot; height=&quot;14&quot; width=&quot;76&quot;>&amp;nbsp;</td>
<td align=&quot;middle&quot; bgColor=&quot;#000000&quot; height=&quot;14&quot; width=&quot;81&quot;></td>
<td align=&quot;middle&quot; bgColor=&quot;#000000&quot; height=&quot;14&quot; width=&quot;82&quot;></td>
<td align=&quot;right&quot; bgColor=&quot;#000000&quot; height=&quot;14&quot; vAlign=&quot;top&quot;></td>
</tr>
</table>
<table border=&quot;0&quot; cellPadding=&quot;0&quot; cellSpacing=&quot;0&quot; height=&quot;13&quot; width=&quot;100%&quot;>
<tr>
<td align=&quot;right&quot; bgColor=&quot;#ffffff&quot; height=&quot;13&quot; vAlign=&quot;top&quot; width=&quot;60%&quot;><IMG border=0 height=1 src=&quot;default_files/clear.gif&quot; width=1></td>
<td align=&quot;left&quot; bgColor=&quot;#999999&quot; height=&quot;13&quot; width=&quot;40%&quot;><IMG border=0 height=1 src=&quot;../Intranet/images/clear.gif&quot; width=1><IMG border=0 height=1 src=&quot;../Intranet/images/clear.gif&quot; width=1></td>
</tr>
</table>
<table border=&quot;0&quot; cellPadding=&quot;0&quot; cellSpacing=&quot;0&quot; width=&quot;600&quot; height=&quot;66&quot;>
<tr>
<td align=&quot;right&quot; vAlign=&quot;top&quot; width=&quot;450&quot; height=&quot;66&quot;></td>
</tr>
</table>
<center><H2><b><font color=&quot;#800000&quot; face=&quot;Verdana&quot; size=&quot;4&quot;><i>Critiques for: <%=(aName) %></i> </font></b></H2>
<hr width=&quot;75%&quot; color=&quot;#808080&quot;>
</center>

<TABLE BORDER=0 WIDTH=&quot;100%&quot;>
<TR ALIGN=middle>
<TD WIDTH=&quot;7%&quot;></TD>
<TD WIDTH=&quot;7%&quot; height=&quot;20&quot;>
<p align=&quot;center&quot;><font size=&quot;1&quot; color=&quot;#000000&quot;>Date</font></p></TD>
<TD WIDTH=&quot;3%&quot; height=&quot;20&quot;>
<p align=&quot;center&quot;><font size=&quot;1&quot; color=&quot;#000000&quot;>Type</font></p>
</TD>
<TD WIDTH=&quot;4%&quot; height=&quot;20&quot;><font size=&quot;1&quot; color=&quot;#000000&quot;>Tone</font></TD>
<TD WIDTH=&quot;4%&quot; height=&quot;20&quot;><font size=&quot;1&quot; color=&quot;#000000&quot;>Expl.</font></TD>
<TD WIDTH=&quot;5%&quot; height=&quot;20&quot;><font size=&quot;1&quot; color=&quot;#000000&quot;>Content</font></TD>
<TD WIDTH=&quot;3%&quot; height=&quot;20&quot;><font size=&quot;1&quot; color=&quot;#000000&quot;>ABC</font></TD>
<TD WIDTH=&quot;5%&quot; height=&quot;20&quot;><font size=&quot;1&quot; color=&quot;#000000&quot;>Wrapup</font></TD>
<TD WIDTH=&quot;6%&quot; height=&quot;20&quot;><font size=&quot;1&quot; color=&quot;#000000&quot;>Understand</font></TD>
<TD WIDTH=&quot;4%&quot; height=&quot;20&quot;><font size=&quot;1&quot; color=&quot;#000000&quot;>Layout</font></TD>
<TD WIDTH=&quot;3%&quot; height=&quot;20&quot;><font size=&quot;1&quot; color=&quot;#000000&quot;>Wait</font></TD>
<TD WIDTH=&quot;5%&quot; height=&quot;20&quot;><font size=&quot;1&quot; color=&quot;#000000&quot;>Duration</font></TD>
<TD WIDTH=&quot;4%&quot; height=&quot;20&quot;><font size=&quot;1&quot; color=&quot;#000000&quot;>Resolve</font></TD>
<TD WIDTH=&quot;4%&quot; height=&quot;20&quot;><font size=&quot;1&quot; color=&quot;#000000&quot;>Relev.</font></TD>
<TD WIDTH=&quot;16%&quot; height=&quot;20&quot;>
<p align=&quot;left&quot; style=&quot;MARGIN-LEFT: 10px&quot;><font size=&quot;1&quot; color=&quot;#000000&quot;>Total</font></p>
</TD>
</TR>
<TR ALIGN=middle>
<TD WIDTH=&quot;7%&quot;></TD>
<TD WIDTH=&quot;72%&quot; height=&quot;20&quot; colspan=&quot;14&quot;>
<FORM NAME=&quot;frmCritique&quot;>

<p align=&quot;left&quot;>

<SELECT Size=4 name=&quot;Critique&quot; onChange=&quot;UpdateCritique('Comments','Email');&quot; style=&quot;font-size: 8pt; font-family: Arial;&quot;>
<%

' Check for default...
'mCountry = Trim(Request(&quot;ListingDate&quot;))
'
' Create the List
Set rsItems=objConn.Execute _
(&quot;SELECT Name,ListingDate,CallType,Tone,Explanation,Content,Grammer,Wrapup,Understanding,Layout,Wait,Duration,Resolution,Relevance,Comments &quot; &amp; _
&quot;FROM Chat &quot; &amp; _
&quot;Where (Analyst) ='&quot; &amp; aName &amp; &quot;'&quot; &amp;_
&quot;ORDER BY ItemID&quot;)



DO WHILE NOT rsItems.EOF
mSelected = &quot;&quot;
IF mCountry=trim(rsItems(&quot;ListingDate&quot;)) then mSelected=&quot; SELECTED&quot;
%>
<OPTION<%=mSelected%>><%=rsItems(&quot;ListingDate&quot;)%>
<%=rsItems(&quot;CallType&quot;)%>
<%=rsItems(&quot;Tone&quot;)%>
<%=rsItems(&quot;Explanation&quot;)%>
<%=rsItems(&quot;Content&quot;)%>
<%=rsItems(&quot;Grammer&quot;)%>
<%=rsItems(&quot;Wrapup&quot;)%>
<%=rsItems(&quot;Understanding&quot;)%>
<%=rsItems(&quot;Layout&quot;)%>
<%=rsItems(&quot;Wait&quot;)%>
<%=rsItems(&quot;Duration&quot;)%>
<%=rsItems(&quot;Resolution&quot;)%>
<%=rsItems(&quot;Relevance&quot;)%>

<%
rsItems.MoveNext
Loop
%>
<BR>
</TD>

</TR>
<TR ALIGN=middle>
<TD WIDTH=&quot;7%&quot;></TD>
<TD WIDTH=&quot;72%&quot; height=&quot;20&quot; colspan=&quot;14&quot;>

</TD>
</TR>
<TR ALIGN=middle>
<TD WIDTH=&quot;7%&quot;></TD>
<TD WIDTH=&quot;72%&quot; height=&quot;20&quot; colspan=&quot;14&quot;>
<p align=&quot;left&quot;><font color=&quot;#000000&quot; size=&quot;2&quot;><b>Comments:</b></font></p></TD>
</TR>
<TR ALIGN=middle>
<TD WIDTH=&quot;7%&quot;></TD>
<TD WIDTH=&quot;72%&quot; height=&quot;20&quot; colspan=&quot;14&quot;>
<p align=&quot;left&quot;><TEXTAREA cols=110 name=&quot;Comments&quot; rows=6 style=&quot;FONT-SIZE: 8pt&quot;></TEXTAREA></p>

</SELECT>
</TD>

</TR>
</FORM>
<TR ALIGN=middle>
<TD WIDTH=&quot;7%&quot;></TD>
<TD WIDTH=&quot;72%&quot; height=&quot;20&quot; colspan=&quot;14&quot;></TD>
</TR>
<TR ALIGN=middle>
<TD WIDTH=&quot;7%&quot;></TD>
<TD WIDTH=&quot;72%&quot; height=&quot;20&quot; colspan=&quot;14&quot;>
<p align=&quot;left&quot;><font color=&quot;#000000&quot; size=&quot;2&quot;><b>Chat/Email:</b></font></p></TD>
</TR>
<TR ALIGN=middle>
<TD WIDTH=&quot;7%&quot;></TD>
<TD WIDTH=&quot;72%&quot; height=&quot;20&quot; colspan=&quot;14&quot;>
<p align=&quot;left&quot;><TEXTAREA cols=110 name=&quot;Chat&quot; rows=6 style=&quot;FONT-SIZE: 8pt&quot;></TEXTAREA></p></TD>
</TR>
</TABLE>

<p align=&quot;center&quot;>&amp;nbsp;<input type=&quot;button&quot; value=&quot;Go Back&quot; onClick=&quot;window.location.href='validated.asp'&quot; id=button1 name=button1>
<input type=&quot;button&quot; value=&quot;Log Out&quot; onClick=&quot;self.close()&quot; id=button2 name=button2></p>
<p align=&quot;left&quot;>&amp;nbsp;</p>

</BODY>
</HTML>
<%
rsItems.Close
Set rsItems = Nothing
%>

_________________________________________________________
here is a copy of the include file:
---------------------------------------------------------

<!-- METADATA TYPE=&quot;typelib&quot;
FILE=&quot;C:\Program Files\Common Files\System\ado\msado15.dll&quot; -->
<%
Dim objConn
Set objConn = Server.CreateObject(&quot;ADODB.Connection&quot;)
objConn.Open &quot;Provider=Microsoft.Jet.OLEDB.4.0; &quot; &amp; _
&quot;Data Source= G:\Inetpub\ &amp; _
&quot;Persist Security Info=TRUE&quot;



If Session(&quot;blnValidUser&quot;) = True and Session(&quot;PersonID&quot;) = &quot;&quot; Then
Dim rsPersonIDCheck
Set rsPersonIDCheck = Server.CreateObject(&quot;ADODB.Recordset&quot;)
Dim strSQL
strSQL = &quot;SELECT PersonID FROM Person &quot; &amp; _
&quot;WHERE EMailAddress = '&quot; &amp; Session(&quot;EMailAddress&quot;) &amp; &quot;';&quot;
rsPersonIDCheck.Open strSQL, objConn
If rsPersonIDCheck.EOF Then
Session(&quot;blnValidUser&quot;) = False
Else
Session(&quot;PersonID&quot;) = rsPersonIDCheck(&quot;PersonID&quot;)
End If
rsPersonIDCheck.Close
Set rsPersonIDCheck = Nothing
End If
%>
_________________________________________________________

Any help you can give would be greatly appreciated...

Thank you in advance,

Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top