Ask a Question related to Coldfusion Database Access, Design and Development.
-
cgacfox #1
Adding and Deleting fields in my media DB
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
onLoanName='#Form.onLoanName#' SET RequestorName='#Form.requestorName#' WHERE
MovieTitle = '#Form.MovieTitle#' </cfquery> <html> <head> <title>DVD Request
Confirmation</title> </head> <body background='images/BGDVD4.gif'> <font
color='ffffcc' face='Geneva, Arial, Helvetica, sans-serif'> </font> <cfoutput>
<h1> <font color='##000000' face='Geneva, Arial, Helvetica, sans-serif'> Thank
you #Form.requestorName#. Your request for #Form.MovieTitle# has been sent to
Cori! </font> </h1> <p> <font color='##000000' size='5' face='Geneva, Arial,
Helvetica, sans-serif'> The next time you get together, Cori will have the
requested movies pulled and ready to go. </font> </p> </cfoutput> <font
color='ffffcc'> <cfprocessingdirective suppresswhitespace='no'> <cfmail
subject='DVD Request' from='cgacfox@comcast.net' to='cgacfox@comcast.net' >
The requested movie is: Movie: #Form.movietitle# Requested by:
#Form.requestorName# </cfmail> </cfprocessingdirective> </font> </body>
</html> 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
-
Adding, deleting images - Acrobat 6 Professional
Apologies in advance if this has been broached before - could not find the exact answer in the FAQs or KB search. 2 scenarios (running AB6 Pro... -
Adding and Deleting a column in SQL
Hi I was wondering how I could remove, or add, a column using SQL in my ASP page, as well as a sample of the code Thanks -Dany -
[PHP] Deleting array fields...
* Thus wrote Jason Giangrande (jason@giangrande.org): unset($array); I don't think it rearranges it. perhaps the docs should mention this in... -
Deleting array fields...
Is there a way to delete array fields without resort the keys? The keys of this particular array are the position of the words it holds to their... -
Deleting fields
A long time ago (on this forum I believe), there was a discussion on deleting fields. It was advised never to delete fields in an established... -
cgacfox #2
Re: Adding and Deleting fields in my media DB
I am still struggling with this code. Every time I try to change something I
get this error: Element ONLOANFLAG is undefined in FORM. The error
occurred in C:\websites\kj2ugz\Securitypages\DVDconfirm.cfm: line 5 3 :
<cfquery name='UpdateDVD' datasource='media'> 4 : UPDATE DVDS 5 : SET
onLoanFlag='#Form.onLoanFlag#' 6 : SET onLoanDate='#Form.onLoanDate#' 7 : SET
onLoanName='#Form.onLoanName#' I want these fields updated in my db when the
person requests a particular movie. The requestorName field populates just
fine. The other fields do not. I realize that a checkbox and a date field
require some tweaking but I am not sure exactly how to do this. Please help!
cgacfox Guest
-
paross1 #3
Re: Adding and Deleting fields in my media DB
How about only using SET once, and put a comma between the fields that you are
updating....
<cfquery name="UpdateDVD" datasource="media">
UPDATE DVDS
SET onLoanName='#Form.onLoanName#',
RequestorName='#Form.requestorName#'
WHERE MovieTitle = '#Form.MovieTitle#'
</cfquery>
Phil
paross1 Guest
-
cgacfox #4
Re: Adding and Deleting fields in my media DB
I tried this and am still getting an error: Element ONLOANFLAG is undefined in
FORM. The error occurred in
C:\websites\kj2ugz\Securitypages\DVDconfirm.cfm: line 5 3 : <cfquery
name='UpdateDVD' datasource='media'> 4 : UPDATE DVDS 5 : SET
onLoanFlag='#Form.onLoanFlag#', 6 : onLoanDate='#Form.onLoanDate#', 7 :
onLoanName='#Form.onLoanName#' I have to define the checkbox for onLoanFlag
and the field for the onLoanDate in date format. This is what I am not sure how
to do.
cgacfox Guest
-
paross1 #5
Re: Adding and Deleting fields in my media DB
Well, where are you setting the value of Form.onLoanFlag before submitting the form to your action page (or any of the other form variables for that matter)?
Phil
paross1 Guest
-
cgacfox #6
Re: Adding and Deleting fields in my media DB
I thought about what you said last night and realized that the page that posts
the info does not have those fields in it. The visitor just enters their name
in a text box and it sends the info to the db. It wouldn't look good to have
the check box for onLoanFlag and the text box for onLoanDate on that page to be
filled out by the visitor. I do have a DVDMaint page where I can add these two
items once I see that someone has requested a dvd. I can also remove these
items when the dvd is returned. I was just looking for an easier way to do
this. I think I will stick with what I have for now. I do thank you for your
help and opening my eyes to how this works in the background. I wasn't thinking
it all the way through.
cgacfox Guest
-
JMGibson3 #7
Re: Adding and Deleting fields in my media DB
<input type=hidden> is a trick to pass fields back to youself via a form without letting users see or modify content.
JMGibson3 Guest



Reply With Quote

