Ask a Question related to Coldfusion Database Access, Design and Development.
-
cgacfox #1
Suddenly having problems with code on site
My hosting site just updated to CF 7 on Saturday and now my code that worked
last week is throwing errors at me. Here is an example of what worked before:
Now I am getting this error: Element DVDNUMBER is undefined in DVD. The
error occurred in C:\websites\kj2ugz\DVDMaint\DVD_Edit.cfm: line 101 99 :
100 : <!--- Save to variables ---> 101 : <CFSET
DVDNumber=Trim(DVD.DVDNumber)> 102 : <CFSET
movieTitle=Trim(DVD.movieTitle)> 103 : <CFSET Director=Trim(DVD.Director)>
When I remove it the next line shows up as the same error. I thought that CF 7
was backwards compatible. Does anyone have any suggestions for me?
<!--- Get the film record --->
<CFQUERY DATASOURCE="media" NAME="DVDS">
SELECT DVDID, DVDNumber, MovieTitle, Director, mainActors, studioHouse,
Genre, Description, runningMinutes, parentalRating, seriesFlag,
seriesName, copyFlag, mdlFlag, gclFlag, onLoanFlag, onLoanDate,
onLoanName, requestorName
FROM DVDs
WHERE DVDID=#URL.DVDID#
</CFQUERY>
<!--- Save to variables --->
<CFSET DVDNumber=Trim(DVD.DVDNumber)>
<CFSET movieTitle=Trim(DVD.movieTitle)>
<CFSET Director=Trim(DVD.Director)>
<CFSET mainActors=Trim(DVD.mainActors)>
<CFSET studioHouse=Trim(DVD.studioHouse)>
<CFSET Genre=Trim(DVD.Genre)>
<CFSET Description=Trim(DVD.Description)>
<CFSET runningMinutes=Trim(DVD.runningMinutes)>
<CFSET parentalRating=Trim(DVD.parentalRating)>
<CFSET seriesFlag=(DVD.seriesFlag)>
<CFSET seriesName=(DVD.seriesName)>
<CFSET copyFlag=(DVD.copyFlag)>
<CFSET mdlFlag=(DVD.mdlFlag)>
<CFSET gclFlag=(DVD.gclFlag)>
<CFSET onLoanFlag=(DVD.onLoanFlag)>
<CFSET onLoanDate=DateFormat(DVD.onLoanDate, "MM/DD/YYYY")>
<CFSET onLoanName=Trim(DVD.onLoanName)>
<CFSET requestorName=Trim(DVD.requestorName)>
cgacfox Guest
-
inserting code to site
HI everyone!! im new to dreamweaver and i could really do with some help. i am using dreamweaver 8 and trying to create my first webpage but i am... -
Email Site-Wide Error message (with code snippet)
I would like to create a Site-Wide error message that is emailed to the administrator. I have a lot of the information I want to put in but I can... -
Perl code to verify web site (SSL) certificate
I have been searching for a script that will allow me to connect to a https web site and confirm that the web server has valid dates and the... -
Writing javascript code in every page of my site using aspx
Good Morning, I would want to use aspx to write this javascript code for me in every page of my site www.etantonio.it how can I do this ??? ... -
What code would I use to ensure a page is accessed by another within my site?
I'm trying to prevent "leeching"..so that users must enter my site to get to the files. Does anyone know a script that will work? Thanks a... -
paross1 #2
Re: Suddenly having problems with code on site
Looks like your cfquery has the parameter NAME="DVDS", but all of the column
variables have a reference of DVD. (DVD.DVDNumber, DVD.movieTitle, etc.) Try
changing your query back to DVD, or the variables to DVDS.whatever.
Phil
paross1 Guest
-
cgacfox #3
Re: Suddenly having problems with code on site
Thanks, that worked. Now going to my books table I am getting this error and
can't figure out why. Element AUTHOR is undefined in FORM. The error
occurred in C:\websites\kj2ugz\Securitypages\author.cfm: line 11 9 : Select *
10 : From Books 11 : WHERE author LIKE '%#FORM.author#%' 12 : Order by
bookTitle 13 : </cfquery> My snippet of code is here: <CFQuery
Name='Displayauthor' Datasource='media'> Select * From Books WHERE author LIKE
'%#FORM.author#%' Order by bookTitle </cfquery> The same code works for
bookTitle and publisher and this code works from the main books page where I
have several ways to look up books. The error happens when I am on either the
bookTitle.cfm page or the publisher.cfm page and want to look up an author. Any
suggestions? I have been over the code several times and have even cut and
pasted again changing to the author info. I can't seem to see the error on this
either. Here is the same code for the bookTitle and publisher pages: <CFQuery
Name='Displaybooktitle' Datasource='media'> Select * From Books WHERE booktitle
LIKE '%#FORM.booktitle#%' Order by bookTitle </cfquery> <CFQuery
Name='Displaypublisher' Datasource='media'> Select * From Books WHERE publisher
LIKE '%#FORM.publisher#%' Order by bookTitle </cfquery>
cgacfox Guest
-
paross1 #4
Re: Suddenly having problems with code on site
Looks like you had more than just a change in ColdFusion version, as you
somehow had changes in your code, since DVD magically changed to DVDS. Having
said that, look at your "sending" page, as I would bet that the form variable
author is not getting set.
paross1 Guest
-
cgacfox #5
Re: Suddenly having problems with code on site
Thank you ever so much! My eyes didn't catch the error the a couple of the
pages. See that is why there are QA people in the world (my husband is one of
them)! Everything is working great now. I just have a lot of data entry to do
to enter all of my books. I may be back in a few days because I want to add
another feature to my media pages. I currently have a page that displays
details about a movie or book and the visitor can enter their name and 'check
out' the movie or book. The name is entered automatically into my db but I also
want the checkout flag marked and the checkout date put in. Then when the movie
or book is returned, I want to be able to remove the info without having to
physically get into the db. I probably need another page for this idea. I will
play around and if I get into trouble I'll post my problems. Again thanks.
cgacfox Guest
-
cgacfox #6
Re: Suddenly having problems with code on site
I'm back! I was adding paging capabilities to my book pages and threw this
error when paging through an author: Element AUTHOR is undefined in FORM.
The error occurred in C:\websites\kj2ugz\Securitypages\author.cfm: line 11 9
: Select * 10 : From Books 11 : WHERE author LIKE '%#FORM.author#%' 12 : Order
by bookTitle 13 : </cfquery> This is the same error I was getting before and I
have checked my code and cannot find where the error is. The first page of the
same author comes up just fine but when I hit the 'next' button, that is when
the error comes up. I will paste all code from the author.cfm page. I copied
the code from by displayallbooks.cfm page and it works just fine.
<!--This sets up a query to be used later on in the table display-->
<!--You can use whatever name you want for the query name but no spaces-->
<!--The datasource name is the one set up in the coldfusion administrators -
the dsn-->
<!--Select * means select all-->
<!--From DVDS refers to the table name inside the database-->
<!--The Order by can be changed to any field you want in the database-->
<CFQuery Name="Displayauthor" Datasource="media">
Select *
From Books
WHERE author LIKE '%#FORM.author#%'
Order by bookTitle
</cfquery>
<CFQuery Name="filterbookgenre" Datasource="media">
Select bookgenre
From bookgenre
Order by bookgenre
</cfquery>
<CFSET RowsPerPage = 15>
<cfparam name="url.startRow" default="1" type="numeric">
<cfset TotalRows = displayauthor.RecordCount>
<cfset EndRow = Min(url.StartRow + RowsPerPage - 1, TotalRows)>
<cfset StartRowNext = EndRow + 1>
<cfset StartRowBack = url.StartRow - RowsPerPage>
<html>
<head>
<title>Book Display</title>
<script language="JavaScript">
<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++)
x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++)
x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_nbGroup(event, grpName) { //v6.0
var i,img,nbArr,args=MM_nbGroup.arguments;
if (event == "init" && args.length > 2) {
if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new
Array();
nbArr[nbArr.length] = img;
for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
if (!img.MM_up) img.MM_up = img.src;
img.src = img.MM_dn = args[i+1];
nbArr[nbArr.length] = img;
} }
} else if (event == "over") {
document.MM_nbOver = nbArr = new Array();
for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
if (!img.MM_up) img.MM_up = img.src;
img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] :
img.MM_up);
nbArr[nbArr.length] = img;
}
} else if (event == "out" ) {
for (i=0; i < document.MM_nbOver.length; i++) {
img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
} else if (event == "down") {
nbArr = document[grpName];
if (nbArr)
for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up;
img.MM_dn = 0; }
document[grpName] = nbArr = new Array();
for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
if (!img.MM_up) img.MM_up = img.src;
img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
nbArr[nbArr.length] = img;
} }
}
//-->
</script>
</head>
<body bgcolor="#5A2E10" link="#FFFFFF" vlink="#FF0000" alink="#FF0000"
onLoad="MM_preloadImages
('../Images/Coributton_f2.gif','../Images/Coributton_f4.gif','../Images/Coributt
on_f3.gif',
'../Images/Gregbutton_f2.gif','../Images/Gregbutton_f4.gif','../Images/Gregbutto
n_f3.gif',
'../Images/Ashtonbutton_f2.gif','../Images/Ashtonbutton_f4.gif','../Images/Ashto
nbutton_f3.gif',
'../Images/Chrisbutton_f2.gif','../Images/Chrisbutton_f4.gif','../Images/Chrisbu
tton_f3.gif',
'../Images/petsbutton_f2.gif','../Images/petsbutton_f4.gif','../Images/petsbutto
n_f3.gif',
'../Images/Dee&Gloriabutton_f2.gif','../Images/Dee&Gloriabutton_f4.gif',
.../Images/Dee&Gloriabutton_f3.gif',
'../Images/Mikebutton_f2.gif','../Images/Mikebutton_f4.gif','../Images/Mikebutto
n_f3.gif',
'../Images/Mark&candybutton_f2.gif','../Images/Mark&candybutton_f4.gif',
'../Images/Mark&candybutton_f3.gif',
'../Images/hometheaterbutton_f2.gif','../Images/hometheaterbutton_f4.gif','../Im
ages/hometheaterbutton_f3.gif',
'/images/dvdmaintbutton_f2.gif','images/dvdmaintbutton_f4.gif','images/dvdmaintb
utton_f3.gif'
'../Images/thelibrarybutton_f2.gif','../Images/thelibrarybutton_f4.gif','../Imag
es/thelibrarybutton_f3.gif',
'images/bookmaintbutton_f2.gif','images/bookmaintbutton_f4.gif','images/bookmain
tbutton_f3.gif'
'../Images/guestbookbutton_f2.gif','../Images/guestbookbutton_f4.gif','../Images
/guestbookbutton_f3.gif',
'../Images/contactusbutton_f2.gif','../Images/contactusbutton_f4.gif','../Images
/contactusbutton_f3.gif')">
<table width="704" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="85" valign="top">
<div align="center">
<img src="Images/libraryheader.gif" alt="Genre Header" width="703"
height="83" align="top">
</div>
</td>
</tr>
</table>
<table width="704" border="0" align="center" cellpadding="2" cellspacing="2"
summary="">
<tr>
<td width="691" height="465" valign="top" background="Images/owl&books2.gif"
bgcolor="#5A2E10">
<h1>
<Div align="center">
<font face="Geneva, Arial, Helvetica, sans-serif">
Book Author Results
</font>
</div>
</h1>
<form method="POST" action="bookGenre.cfm">
<font face="Geneva, Arial, Helvetica, sans-serif">
<strong>Select Book Genre:<br>
<Select Name="bookGenre">
<Option value="">Filter by bookGenre</option>
<cfoutput query="filterbookGenre">
<option value="#bookGenre#">#bookGenre#</option>
</cfoutput>
</select>
<input type="submit" value="Go">
</strong>
</font>
</FORM>
<form method="Post" action="booktitle.cfm">
<strong>
<font face="Geneva, Arial, Helvetica, sans-serif"> Enter name of the book
that you are interested in seeing.<br>
<input type="text" name="booktitle" size="50">
<input type="submit" value="Go">
</font>
</strong>
</form>
<form method="Post" action="author.cfm">
<strong>
<font face="Geneva, Arial, Helvetica, sans-serif"> Enter name of the
author that you are interested in seeing.<br>
<input type="text" name="author" size="50">
<input type="submit" value="Go">
</font>
</strong>
</form>
<form method="Post" action="publisher.cfm">
<strong><font face="Geneva, Arial, Helvetica, sans-serif"> Enter name
of the publisher that you are interested in seeing.<br>
<input type="text" name="publisher" size="50">
<input type="submit" value="Go">
</font>
</strong>
</form>
<form method="Post" action="displayallbooks.cfm">
<strong><font face="Geneva, Arial, Helvetica, sans-serif"> If you would
like to see all titles please click here</font></strong><font face="Geneva,
Arial, Helvetica, sans-serif">.
<input type="submit" value="Go">
<br>
<font size="5"> WARNING: Due to the size of the database, this could take
some time to download.</font><br>
</font>
</form>
</td>
</tr>
</table>
<p> </p>
<table width="704" border="0" align="center" cellpadding="2" cellspacing="0">
<tr>
<td height="116">
<!--Message about which rows are being displayed-->
<cfoutput>
<p>
<span class="style4">
<font color="##FFFFFF" face="Geneva, Arial, Helvetica, sans-serif">
Displaying <b>#url.StartRow#</b> to <b>#EndRow#</b>
of <b>#TotalRows#</b> Records
</font>
</span>
</p>
<p>
<font color="##FFFFFF" face="Geneva, Arial, Helvetica, sans-serif">Sorted by
page
</font>
</p>
<p>
<cfinclude template="NextNIncludePageLinks.cfm">
<br>
</p>
</cfoutput>
</td>
<td>
</td>
<td align="right">
<!--Provide Next/Back links-->
<cfinclude template="NextNIncludeBackNext1.cfm">
</td>
</tr>
<td width="40%" class="style1">
<div align="center">
<strong>
<font color="#FFFFFF" face="Geneva, Arial, Helvetica, sans-serif">Book Title
</font>
</strong>
</div>
</td>
<td width="26%" class="style1">
<div align="center">
<strong>
<font color="#FFFFFF" face="Geneva, Arial, Helvetica, sans-serif">Book Genre
</font>
</strong>
</div>
</td>
<td width="34%" class="style1">
<div align="center">
<strong>
<font color="#FFFFFF" face="Geneva, Arial, Helvetica,
sans-serif">Author</font>
</strong>
</div>
</td>
</tr>
<!--Here is where the cfoutput begins-->
<!--The query name defined above is used-->
<cfif Displayauthor.RecordCount EQ 0>
<script language="javascript">
alert("Your search has resulted in no matches or you have misspelled the name.
Please try again!");
history.go(-1);
</script>
<cfelse>
<cfloop query="Displayauthor" StartRow="#url.StartRow#" Endrow="#EndRow#">
<cfoutput>
<!--An if statement that tests to see if the row is odd or even-->
<cfif currentrow mod 2 is 1>
cgacfox Guest
-
tjfrevert #7
Re: Suddenly having problems with code on site
When you click on the next link the form variables are no longer defined
because you aren't resubmitting the form. The easiest way to fix it is to make
the next button part of a form that has some hidden fields with the info you
need for your queries.
tjfrevert Guest
-
cgacfox #8
Re: Suddenly having problems with code on site
Thanks. I added a filter that I had on some other pages for my DVDs and it worked. I appreciate the help.
cgacfox Guest
-
cgacfox #9
Re: Suddenly having problems with code on site
Now I am ready for help in another aspect of my media pages. I currently have
pages that give details on books or dvds. When a visitor wants to borrow a
book or dvd, they submit a form that updates my db with their name in a
particular field and then it sends me an email. I want to add a check in the
onLoanFlag checkbox field and the date requested in the onLoanDate field
automatically. Once the book has been returned I want to be able to remove
these items from the fields without going directly into the db (probably a new
cfm page). Here is the code to get the requestorName in the db: <cfquery
name='UpdateDVD' datasource='media'> UPDATE DVDS SET
RequestorName='#Form.requestorName#' WHERE MovieTitle = '#Form.MovieTitle#'
</cfquery> I know it is not as easy as SETting these fields since they are not
text fields. Any suggestions on how to accomplish this?
cgacfox Guest



Reply With Quote

