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

Updating ASP Page With Frames and ListBox

Status
Not open for further replies.

nashman

Programmer
Dec 24, 2001
24
CA
I am really hoping someone can help me out with this. I am new to ASP. I have searched everywhere and I am sure this is probably a simple issue to resolve but I can't seem to find the answer.

I have 2 frames. The left frame has a listbox which I want the users to make a selection from.

Based on this selection, I would like for the information shown in the right frame to be updated, It should return a single recordset for each selection in the listbox.

Here is the code from the left frame...

Code:
<!--#INCLUDE FILE="Include/Setup.asp" -->
<%Dim MovieList, NewMovieTitle
SQL = "Select Title From Movies"
SQL= SQL & " Order By Title"
Set MovieList = Server.CreateObject("ADODB.Recordset")
MovieList.CursorType = 1
MovieList.Open SQL, Conn
%>
<html>
<head>

<SCRIPT LANGAUAGE='javascript'>
function setNameFromSelect(sel) {
    document.getElementById('MovieNameVal').value=sel.options[sel.selectedIndex].value;
	document.frmGetMovieTitle.submit();
}
</SCRIPT>

</head>

<body bgcolor="#4287C9" >

<font size="2" color="#000000" face="Tahoma">
<br /><br />
<table border="0"  width="100%">
  <tr>
     <td>
<FORM NAME="frmGetMovieTitle" ACTION="MovieCard.asp?MovieTitle="&MovieNameVal TARGET="MainBodyFrame" METHOD="post">
<select name="movie_title" align="left" size="25" OnChange="setNameFromSelect(this)" selected value=<%=MovieList("Title")%>>
<%
If MovieList.RecordCount <> 0 Then
Do While Not MovieList.EOF%>
  <option value='<%=MovieList("Title")%>'><%=Left(MovieList("Title"),39)%></option>
 <%
		RecCount = RecCount + 1
		MovieList.MoveNext
	Loop
Else
RecCount = 0
%>
<option value="">No movies currently available</option>
<%
End If ' end If MovieList.RecordCount <> 0
%>
</select>
<%
MovieList.Close
Set MovieList = Nothing
Conn.Close
Set Conn = Nothing
%> 
	 </td><!-- Col 1 -->
  </tr>
  <tr></div>
<br />

</font>
     <td><br /><div align="center"><b><font size="2" color="#000000" face="Tahoma"><%=RecCount%> movies currently listed !</font></b><br /><br /></div></td><!-- Col 1 -->
	</tr>
</table>
<input type="text" name="MovieNameVal" value="" size="50">
</FORM>
</body>
</html>

This is the code to gather the details based on the QueryString from Nav.asp

Code:
<!--#INCLUDE FILE="Include/Setup.asp" -->
<%Dim MovieCrd, MY_MOVIE_TITLE, MY_MOVIE_ORIGINALTITLE, MY_MOVIE_DIRECTOR, MY_MOVIE_GENRE, MY_MOVIE_YEAR, MY_MOVIE_RATED, MY_MOVIE_LANGUAGE, MY_MOVIE_MPAA, MY_MOVIE_LANGUAGEENCODED, MY_MOVIE_CODEC, MY_MOVIE_BITRATE, MY_MOVIE_RESOLUTION, MY_MOVIE_AUDIO, MY_MOVIE_ABITRATE, MY_MOVIE_CHANNELS, MY_MOVIE_NCD, MY_MOVIE_LENGTH, MY_MOVIE_RIPPER, MY_MOVIE_ACTORS, MY_MOVIE_NOTES, MY_MOVIE_PLOT
MovieTitle=Request.QueryString("MovieTitle")
If MovieTitle<>"" Then
SQL = "Select * From Movies"
SQL= SQL & " Where Title = '" & MovieTitle & "'"
SQL= SQL & " Order By Title"
Else
SQL="Select Top 1 * From Movies"
End IF
Set MovieCrd = Server.CreateObject("ADODB.Recordset")
MovieCrd.CursorType = 1
MovieCrd.Open SQL, Conn
%>

The variable MovieTitle is defined in my include Setup.asp file.

I can populate the list box and I use the MovieNameVal textbox for validation as I work through this process.

My OnChange event populates the MovieNameVal textbox, and submits the form. However, the right frame never gets the QueryString that I am trying to pass to it. I have tried every permutation of the form ACTION but can't seem to figure this out.

These are 2 separate pages named Nav.asp which resides in the NavFrame, and MovieCard.asp which is the intended target for the QueryString which resides in the MainBodyFrame.

Any help would be greatly appreciated.

Thanks,
 
It looks like you're using this form and trying to add a querystring from an input on the form to the form action.

The first question is why don't you just use Request.Form("MovieNameVal") instead of Request.Querystring("MovieTitle")?

I can think of a number of interesting ways to put a form input into a querystring on the action of the same form, but in this case I would require some more explanation as to why it needs to be a querystring instead of its Request.Form value. From the looks of the fields names and such I would expect there could be a space in the input MovieNameVal, which will make it that much more likely to be missent as a querystring value.
 
Thanks ecwcee. I did just that ( Request.Form ) and it worked. I had tried this earlier but to no avail. I must have misspelled something.

Thanks again for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top