Carolina CF User Group (CCFUG)
I'm wondering if anyone here has been part of this group, Carolina ColdFusion User Group (http://www.ccfug.org/home.cfm) ? Meets tonight in Chapel Hill, NC at 7 PM at the Hanes Building, Room #2, on the UNC campus. P@tty Ayers ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: Could Not Delete From Specified Tables
Andy - Thank you very much for this response. I think I understand a lot better, and I'm reading the Access book and database theory book to get a better grip on this. I'm considering re-building my database now, which is why I'm not pursuing this particular question further. I think it could be improved upon greatly and I might be able to avoid a lot of similar problems. Thanks again, P@tty Patty: When you go into the relationships window in Access 2000, you can add your tables (which I gather you've done) to the diagram and then specify which fields match up, whether to enforce referential integrity between them, and what join type they use. Basically once you relate a primary key to other fields, those fields are considered foreign keys to the primary. So you only want one primary key called cabinID in the cabins table. The cabinID fields in the other two tables, the photo tables, will be foreign keys, which you don't have to specify directly. Basically they can even be foreign keys if you DON'T specify a relationship between them and the primary key, however as a best practice you want to have the database do as much work as possible so you don't have to manually enforce the relationships or cascade update and delete manually within your code. I've responded more below under your questions: -Original Message- From: P@tty Ayers [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 05, 2001 7:59 PM To: CF-Talk Subject: Re: Could Not Delete From Specified Tables Andy - Thanks for your response. (Still welcoming any help from others as well..) Do you mean you have a primary key called photoID in this table as a primary key? cabinID in this table should be a foreign key, related to the cabins table. Okay, I just checked and no, actually I didn't make photoID in the table 'photos' a primary key. I *did* make 'otherphotoID' in 'otherphotos' a primary key. Let me see if I am understanding you - should the two secondary tables, each which have a 'cabinID' column, each have 'cabinID' as a foreigh key, and neither should have a primary key? Both should have a primary key (again as a good database design practice, but not always necessary). Name the keys whatever you want. I suggest photoID and otherphotoID, as you have it now. Both should also have cabinID as a foreign key, related to the primary key cabinID in the cabins table. And (forgive my ignorance) how do I make a foreign key? I'm looking in Access's help files and a reference book, but haven't found it yet. In the relationships window, you can specify which keys are related. You can, for instance, click on the primary key in cabins (cabinID), hold down the mouse button and drag to the foreign key in photos (cabinID). A box will pop up (I take it you might've done this already) where you can specify more options for how the fields are related, join types, and more. Sorry if I've repeated myself -- it's late and time to sleep! - Andy ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: Could Not Delete From Specified Tables
Ben - Thanks very much for this response. I have the feeling I've built this database incorrectly, and I'm considering re-doing it. I will keep you posted! Appreciate your help, P@tty P@tty, If you have the tables related, with 'cabins' as the "parent" table, you cannot normally delete a 'cabins' record while there exist "child" records in 'photos' or 'otherphotos' with the same key (cabinID). You can use cascading delete in Access to do this. (As in "flows downhill".) Or, you can first delete all the photos for that cabinID, and subsequently delete the cabin record. ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
OT: Thank you!
Please excuse this off-topic post, but I really have to thank Kelly Matthews, whose solution to my form/query problem worked beautifully, as well as Randy, Jeff. Phoen, Christopher, and Al, whose suggestions I also printed, pored over, and learned from. This list is awesome, and as a CF newbie I'm very grateful for the help. P@tty Ayers Macromedia Evangelist Dreamweaver Resources, FAQs, and Tutorials: http://www.thepattysite.com/dreamweaver/ P@tty's ColdFusion Site http://carolina.cf-developer.net Carolina Web Solutions http://www.carolinawebsolutions.com "Design in art, is a recognition of the relation between various things, various elements in the creative flux. You can't invent a design. You recognise it, in the fourth dimension. That is, with your blood and your bones, as well as with your eyes." - D. H. Lawrence "Well-behaved women seldom make history." - Anonymous ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Newbie problem: Search on Yes/No Column
Friends: I thought that I had this solved, but not quite. Can anyone help? The problem: I need to search on a "yes/no" column - several of them - allowing the user to choose that this field "Doesn't Matter" or else "Yes". There's a search page and a results page. The database has a column "cabinHottub", and the search form a menu "hashottub". I was given the following (below), which returns all records for the "Doesn't Matter" menu choice - but for some reason, *also returns all records for the "Yes" choice*. I'm sure this is something I've done incorrectly, but I'm afraid I don't know what. This code (see below) is exactly what I am currently testing. I feel like there should be something like cfparam name="rs2__hashottub" default="#hashottub#" cfparam name="hashottub" default="0" on the Results page as well, but I'm really not sure, obviously. Any help would be GREATLY appreciated, as I am really stuck on this, and just cannot find it in the reference books. Thank you again, P@tty Ayers Macromedia Evangelist - !--- Menu search object from Search Page --- Put a value of nothing in the option field for doesn't matter. see below: pHot Tub: /p p select name="hashottub" option VALUE="" selectedDoesn't Matter/option option value="1"Yes/option /select /p !--- Query from Results Page: --- cfquery name="rs2" datasource=#MM_connAsheville_DSN# username=#MM_connAsheville_USERNAME# password=#MM_connAsheville_PASSWORD# SELECT cabins.cabinID, cabins.cabinName, cabins.cabinCity, cabins.cabinBedrooms, cabins.cabinBathrooms, cabins.cabinSleeps, cabins.cabinNightly, cabins.cabinWeekly, photos.photosThumbPhotoName FROM cabins INNER JOIN photos ON cabins.cabinID = photos.cabinID WHERE cabinDistance = #rs2__vardistance# AND cabinBedrooms = #rs2__varnumberbedrooms# AND cabinBathrooms = #rs2__varnumberbathrooms# AND cabinSleeps = #rs2__varsleepsatleast# ORDER BY cabinName CFIF IsDefined("hashottub") and hashottub IS NOT "" AND hashottub = 1 /CFIF /cfquery - ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: Newbie problem: Search on Yes/No Column
Randy (and/or anyone else willing to help!) - Thanks very much. But I've trying this exactly the way you've shown (code is quoted at the very bottom of this message), and I get an error message, which I've pasted directly below. Any idea why?? The column name in the database is 'cabinHottub'.. does that belong in the SQL? I apologize again for these beginner questions. Again, many thanks for your help. P@tty --- ODBC Error Code = 07001 (Wrong number of parameters) [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1. Hint: The cause of this error is usually that your query contains a reference to a field which does not exist. You should verify that the fields included in your query exist and that you have specified their names correctly. SQL = "SELECT cabins.cabinID, cabins.cabinName, cabins.cabinCity, cabins.cabinBedrooms, cabins.cabinBathrooms, cabins.cabinSleeps, cabins.cabinNightly, cabins.cabinWeekly, photos.photosThumbPhotoName FROM cabins INNER JOIN photos ON cabins.cabinID = photos.cabinID WHERE cabinDistance = 200 AND cabinBedrooms = 1 AND cabinBathrooms = 1 AND cabinSleeps = 1 ORDER BY cabinName AND hashottub = 1" -- You need to assign a value to the Doesn't Matter such as this select name="hashottub" option VALUE="0" selectedDoesn't Matter/option option value="1"Yes/option /select Then your query would read: cfquery name="rs2" datasource=#MM_connAsheville_DSN# username=#MM_connAsheville_USERNAME# password=#MM_connAsheville_PASSWORD# SELECT cabins.cabinID, cabins.cabinName, cabins.cabinCity, cabins.cabinBedrooms, cabins.cabinBathrooms, cabins.cabinSleeps, cabins.cabinNightly, cabins.cabinWeekly, photos.photosThumbPhotoName FROM cabins INNER JOIN photos ON cabins.cabinID = photos.cabinID WHERE cabinDistance = #rs2__vardistance# AND cabinBedrooms = #rs2__varnumberbedrooms# AND cabinBathrooms = #rs2__varnumberbathrooms# AND cabinSleeps = #rs2__varsleepsatleast# ORDER BY cabinName CFIF IsDefined("hashottub") and hashottub NEQ "0" AND hashottub = 1 /CFIF /cfquery ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: Newbie problem: Search on Yes/No Column
Okay - success! As several of you kindly pointed out: You can't have filters after the Order By Clause ORDER BY cabinName AND hashottub = 1 I did that, and then stumbled upon what I think was giving me the error messages. This: CFIF IsDefined("hashottub") and hashottub NEQ "0" AND hashottub = 1 /CFIF Needed to be this: CFIF IsDefined("hashottub") and hashottub NEQ "0" AND cabinHottub = 1 /CFIF 'cabinHottub' is the name of the column in the database. I might not have been clear about that. In any case, it seems to be WORKING! Thanks very much to all who replied. I now need to apply this to the 3 other yes/no search fields, and I'm praying that it works.. lol. Many MANY thanks, P@tty Ayers Macromedia Evangelist CF Newbie ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Could Not Delete From Specified Tables
Ok, you all helped me tremendously this morning, so I'm hoping someone can point me in the right direction on this new problem. I've created a Delete Record page, but when I test it, I get an error message simply saying "Could not delete from specified tables." Any ideas at all why? A little information on the database: It's in Access2000 and has three tables, 'cabins', 'photos' and 'otherphotos'. cabins has cabinID as its primary key, each rental cabin is a record. photos also has cabinID as a primary key, and I created a relationship between the two tables using the two cabinID fields. otherphotos has otherphotoID as its primary key, and each record is a photo, each associated with, again, cabinID. cabins is related to otherphotos by the cabinID column. Both of the relationships are one-to-many, and I have checked "Enforce Referential Integrity" and "Cascade Update Related Fields." Your help and suggestions are GREATLY appreciated! P@tty Ayers Macromedia Evangelist ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: Could Not Delete From Specified Tables
Andy - Thanks for your response. (Still welcoming any help from others as well..) Do you mean you have a primary key called photoID in this table as a primary key? cabinID in this table should be a foreign key, related to the cabins table. Okay, I just checked and no, actually I didn't make photoID in the table 'photos' a primary key. I *did* make 'otherphotoID' in 'otherphotos' a primary key. Let me see if I am understanding you - should the two secondary tables, each which have a 'cabinID' column, each have 'cabinID' as a foreigh key, and neither should have a primary key? And (forgive my ignorance) how do I make a foreign key? I'm looking in Access's help files and a reference book, but haven't found it yet. My original message is quoted below. Thank you again, P@tty [original message] I've created a Delete Record page, but when I test it, I get an error message simply saying "Could not delete from specified tables." Any ideas at all why? A little information on the database: It's in Access2000 and has three tables, 'cabins', 'photos' and 'otherphotos'. cabins has cabinID as its primary key, each rental cabin is a record. photos also has cabinID as a primary key, and I created a relationship between the two tables using the two cabinID fields. otherphotos has otherphotoID as its primary key, and each record is a photo, each associated with, again, cabinID. cabins is related to otherphotos by the cabinID column. Both of the relationships are one-to-many, and I have checked "Enforce Referential Integrity" and "Cascade Update Related Fields." otherphotos has otherphotoID as its primary key, and each record is a photo, each associated with, again, cabinID. cabins is related to otherphotos by the cabinID column. Both of the relationships are one-to-many, and I have checked "Enforce Referential Integrity" and "Cascade Update Related Fields." Are you trying to delete a cabin record? It should work then, and also cascade delete all records that contain a foreign key in the other photo tables, based on how you say you have it set up. If you DO have the cabinID set as a primary key in the photos table, this could be your problem. Your help and suggestions are GREATLY appreciated! P@tty Ayers Macromedia Evangelist - Andy ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
How to Allow a Doesn't Matter Variable in a Search?
Friends: Can anyone help with this problem I'm stuck on? Not sure if this is a simple one or not, but in any case I'll sure be delighted to get it working. This set of pages allows the user to search a set of records using 9 search objects. Four of those are for searching yes/no (1/0) fields in the Access2000 database. For the four search fields which search yes/no columns, I want them to choose either "This doesn't matter - don't include this in the search" OR "Include only records with "yes" (1) in this column. They need to be able to specify that they want to see only rental properties that have a hot tub, or else that this doesn't matter to them. Obviously this differs from offering the choice between "Include only records with 'yes' in this column" and "Include only records with 'no' in this column", which is *not* what I need to do here. This could be done with checkboxes or a menu - but I can't figure out how to allow that "This doesn't matter" search parameter. Thanks very much in advance for your help! P@tty Ayers Macromedia Evangelist Dreamweaver Resources, FAQs, and Tutorials: http://www.thepattysite.com/dreamweaver/ P@tty's ColdFusion Site http://carolina.cf-developer.net Carolina Web Solutions http://www.carolinawebsolutions.com "Design in art, is a recognition of the relation between various things, various elements in the creative flux. You can't invent a design. You recognise it, in the fourth dimension. That is, with your blood and your bones, as well as with your eyes." - D. H. Lawrence "Well-behaved women seldom make history." - Anonymous ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Kelly: Can you clarify further?
Kelly, Well if it doesn't matter just don't pass the parameter have it set with a value of "" and then when you run the query CFIF parameter IS "YES"where hottub = Yes/CFIFetc that way if they pass the parameter blank it won't include it in the search, hence pulling up records that do and/or don't include hottubs. Is that what you mean? If not let me know. Yes, that's exactly what I mean, but I'm afraid I'm still not sure what goes where. Here's what I currently have on the search page: td pHot Tub: /p p select name="hashottub" option selectedDoesn't Matter/option option value="1"Yes/option /select /p /td And here's the results page, below (code generated mostly by UltraDev..), where I haven't yet referred to the search variable "hashottub" from the search page. Would you possibly be so kind as to explain where the cfif goes and possibly clarify what my variables should look like? Thank you so much, P@tty cfinclude template="Connections/connAsheville.cfm" cfparam name="distance" default="200" cfparam name="numberbedrooms" default="1" cfparam name="numberbathrooms" default="1" cfparam name="sleepsatleast" default="1" cfparam name="rs2__vardistance" default="#distance#" cfparam name="rs2__varnumberbedrooms" default="#numberbedrooms#" cfparam name="rs2__varnumberbathrooms" default="#numberbathrooms#" cfparam name="rs2__varsleepsatleast" default="#sleepsatleast#" cfquery name="rs2" datasource=#MM_connAsheville_DSN# username=#MM_connAsheville_USERNAME# password=#MM_connAsheville_PASSWORD# SELECT cabins.cabinID, cabins.cabinName, cabins.cabinCity, cabins.cabinBedrooms, cabins.cabinBathrooms, cabins.cabinSleeps, cabins.cabinNightly, cabins.cabinWeekly, photos.photosThumbPhotoName FROM cabins INNER JOIN photos ON cabins.cabinID = photos.cabinID WHERE cabinDistance = #rs2__vardistance# AND cabinBedrooms = #rs2__varnumberbedrooms# AND cabinBathrooms = #rs2__varnumberbathrooms# AND cabinSleeps = #rs2__varsleepsatleast# ORDER BY cabinName /cfquery cfset rs2_NumRows = 0 cfset rs2_Index = 1 cfscript Repeat1_NumRows = 5; rs2_NumRows = rs2_NumRows + Repeat1_NumRows; /cfscript cfscript // *** Recordset Stats, Move To Record, and Go To Record: set stats variables // set the record count rs2_total = rs2.RecordCount; // set the number of rows displayed on this page If (rs2_NumRows LT 0 OR rs2_NumRows GTE rs2_total) { rs2_NumRows = rs2_total; } Else If (rs2_NumRows EQ 0) { rs2_NumRows = 1; } // set the first and last displayed record rs2_first = Min(1, rs2_total); rs2_last = Min(rs2_NumRows, rs2_total); /cfscript cfscript MM_paramName = ""; /cfscript cfscript // *** Move To Record and Go To Record: declare variables MM_rs= rs2; MM_rsCount = rs2_total; MM_size = rs2_NumRows; MM_uniqueCol = ""; MM_paramName = ""; MM_offset = 1; MM_atTotal = false; MM_paramIsDefined = false; If (MM_paramName NEQ "") MM_paramIsDefined = IsDefined(MM_paramName); /cfscript cfscript // *** Move To Record: handle 'index' or 'offset' parameter If (NOT MM_paramIsDefined AND MM_rsCount NEQ 0) { // use index parameter if defined, otherwise use offset parameter If (IsDefined("index")) { MM_offset = index; } Else If (IsDefined("offset")) { MM_offset = offset; } // check if we are past the end of the recordset If (MM_offset GT MM_rsCount OR MM_offset EQ 0) { // past end or move last If ((MM_rsCount MOD MM_size) NEQ 0) {// last page not a full repeat region MM_offset = MM_rsCount - (MM_rsCount MOD MM_size) + 1; } Else { MM_offset = MM_rsCount - MM_size + 1; } } } /cfscript cfscript // *** Move To Record: replace the current query, for navigation on a detail page If (MM_size EQ 1) { // if no repeated regions are defined // create a new query with one row MM_newQuery = QueryNew(MM_rs.ColumnList); QueryAddRow(MM_newQuery, 1); // copy the data in the row pointed to by MM_offset to the new query MM_columns = ListToArray(MM_rs.ColumnList,","); For (i=1; i LTE ArrayLen(MM_columns); i=i+1) { QuerySetCell(MM_newQuery, MM_columns[i], MM_rs[MM_columns[i]][MM_offset], 1); } // change the recordset to be only this one row rs2 = MM_newQuery; } /cfscript cfscript // *** Move To Record: update recordset stats // set the first and last displayed record rs2_first = Min(MM_offset, MM_rsCount); rs2_last = Min(MM_offset + MM_size - 1, MM_rsCount); // set the starting index for repeated regions on this recordset rs2_Index = MM_offset; // set the boolean used by hide region to check if we are on the last record MM_atTotal = (MM_offset + MM_size - 1 GTE MM_rsCount); /cfscript cfscript // *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters // create the list of parameters which should not be maintained MM_removeList = "index="; If (MM_paramName NEQ "") MM_removeList = MM_removeList "" MM_paramName "="; MM_keepURL="";
Displaying yes/no field dynamically in checkboxes?
Friends, I would much appreciate any help with a problem I'm stuck on. I'm writing a page that will allow my client to edit a record. I've got it so that the page queries the table and inserts the values from the record specified by the numeric variable passed to it. The numeric fields, text fields and memo fields appear, but I can't figure out how to make the checkboxes display a check when the yes/no field is "yes". Here's my code (below), such as it currently is. UltraDev wrote some of it and I wrote the rest. The first few yes/no fields are "cabinHottub", "cabinJettedtub", "cabinFireplace" and "cabinPets". I would be grateful for any help; thanks very much in advance. P@tty Ayers cfinclude template="Connections/connAsheville.cfm" cfparam name="cabintoedit" default="0" cfparam name="rsEdit__varcabintoedit" default="#cabintoedit#" cfquery name="rsEdit" datasource=#MM_connAsheville_DSN# username=#MM_connAsheville_USERNAME# password=#MM_connAsheville_PASSWORD# SELECT * FROM cabinQuery WHERE cabinID = #rsEdit__varcabintoedit# /cfquery !DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" html head titleEdit a Record Page/title /head body bgcolor="#FF" !-- FORM SECTION -- cfoutput query = "rsEdit" form name="add_form" method="post" action="editsuccess.cfm" input type="hidden" name="cabinID" value="#cabinID#" table width="90%" border="1" cellspacing="0" cellpadding="5" align="center" bordercolor="##CC" tr tdCabin Name:/td td input type="text" name="cabinName" maxlength="50" value="#cabinName#" /td tdLocation (City):/td td input type="text" name="cabinCity" maxlength="50" value="#cabinCity#" /td /tr tr tdDistance from Asheville:/td td input type="text" name="cabinDistance" maxlength="3" size="3" value="#cabinDistance#" /td tdNumber of Bedrooms:/td td input type="text" name="cabinBedrooms" maxlength="2" size="2" value="#cabinBedrooms#" /td /tr tr tdNumber of Bathrooms:/td td input type="text" name="cabinBathrooms" maxlength="2" size="2" value="#cabinBathrooms#" /td tdSleeps:/td td input type="text" name="cabinSleeps" maxlength="2" size="2" value="#cabinSleeps#" /td /tr tr tdHot tub:/td td input type="checkbox" name="cabinHottub" value="#cabinHottub#" /td tdJetted tub:/td td input type="checkbox" name="cabinJettedtub" value="#cabinJettedtub#" /td /tr tr tdFireplace:/td td input type="checkbox" name="cabinFireplace" value="#cabinFireplace#" /td tdPet-friendly:/td td input type="checkbox" name="cabinPets" value="#cabinPets#" /td /tr tr tdNightly Rate:/td td $ input type="text" name="cabinNightly" size="4" maxlength="4" value="#cabinNightly#" /td tdWeekly Rate:/td td $ input type="text" name="cabinWeekly" size="4" maxlength="4" value="#cabinWeekly#" /td /tr tr tdBedroom 1:/td td input type="text" name="cabinBedroom1" maxlength="50" value="#cabinBedroom1#" /td tdBedroom 2:/td td input type="text" name="cabinBedroom2" maxlength="50" value="#cabinBedroom2#" /td /tr tr tdBedroom 3:/td td input type="text" name="cabinBedroom3" maxlength="50" value="#cabinBedroom3#" /td tdBedroom 4:/td td input type="text" name="cabinBedroom4" maxlength="50" value="#cabinBedroom4#" /td /tr tr tdBedroom 5:/td td input type="text" name="cabinBedroom5" maxlength="50" value="#cabinBedroom5#" /td tdSleep Sofa:/td td input type="text" name="cabinSleepsofa" maxlength="50" value="#cabinSleepsofa#" /td /tr tr tdLoft:/td td input type="text" name="cabinLoft" maxlength="50" value="#cabinLoft#" /td tdDishwasher:/td tdinput type="checkbox" name="cabinDishwasher" value="#cabinDishwasher#"/td /tr tr tdMicrowave:/td tdinput type="checkbox" name="cabinMicrowave" value="#cabinMicrowave#"/td tdAir Conditioning:/td tdinput type="checkbox" name="cabinAC" value="#cabinAC#"/td /tr tr tdStereo/CD Player:/td tdinput type="checkbox" name="cabinStereoCD" value="#cabinStereoCD#"/td tdTV:/td td input type="text" name="cabinTV" maxlength="50" value="#cabinTV#" /td /tr tr tdVCR:/td tdinput type="checkbox" name="cabinVCR" value="#cabinVCR#"/td tdWasher/Dryer:/td td input type="text" name="cabinWashdry" maxlength="50" value="#cabinWashdry#" /td /tr tr tdDeck/Porch:/td tdinput type="checkbox" name="cabinDeckporch" value="#cabinDeckporch#"/td tdGrill:/td td input type="text" name="cabinGrill" maxlength="50"
Displaying yes/no field dynamically in checkboxes
Friends, I would much appreciate any help with a problem I'm stuck on. I'm writing a page that will allow my client to edit a record. I've got it so that the page queries the table and inserts the values from the record specified by the numeric variable passed to it. The numeric fields, text fields and memo fields appear, but I can't figure out how to make the checkboxes display a check when the yes/no field is "yes". Here's my code (below), such as it currently is. UltraDev wrote some of it and I wrote the rest. The first few yes/no fields are "cabinHottub", "cabinJettedtub", "cabinFireplace" and "cabinPets". I would be grateful for any help; thanks very much in advance. P@tty Ayers cfinclude template="Connections/connAsheville.cfm" cfparam name="cabintoedit" default="0" cfparam name="rsEdit__varcabintoedit" default="#cabintoedit#" cfquery name="rsEdit" datasource=#MM_connAsheville_DSN# username=#MM_connAsheville_USERNAME# password=#MM_connAsheville_PASSWORD# SELECT * FROM cabinQuery WHERE cabinID = #rsEdit__varcabintoedit# /cfquery !DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" html head titleEdit a Record Page/title /head body bgcolor="#FF" !-- FORM SECTION -- cfoutput query = "rsEdit" form name="add_form" method="post" action="editsuccess.cfm" input type="hidden" name="cabinID" value="#cabinID#" table width="90%" border="1" cellspacing="0" cellpadding="5" align="center" bordercolor="##CC" tr tdCabin Name:/td td input type="text" name="cabinName" maxlength="50" value="#cabinName#" /td tdLocation (City):/td td input type="text" name="cabinCity" maxlength="50" value="#cabinCity#" /td /tr tr tdDistance from Asheville:/td td input type="text" name="cabinDistance" maxlength="3" size="3" value="#cabinDistance#" /td tdNumber of Bedrooms:/td td input type="text" name="cabinBedrooms" maxlength="2" size="2" value="#cabinBedrooms#" /td /tr tr tdNumber of Bathrooms:/td td input type="text" name="cabinBathrooms" maxlength="2" size="2" value="#cabinBathrooms#" /td tdSleeps:/td td input type="text" name="cabinSleeps" maxlength="2" size="2" value="#cabinSleeps#" /td /tr tr tdHot tub:/td td input type="checkbox" name="cabinHottub" value="#cabinHottub#" /td tdJetted tub:/td td input type="checkbox" name="cabinJettedtub" value="#cabinJettedtub#" /td /tr tr tdFireplace:/td td input type="checkbox" name="cabinFireplace" value="#cabinFireplace#" /td tdPet-friendly:/td td input type="checkbox" name="cabinPets" value="#cabinPets#" /td /tr tr tdNightly Rate:/td td $ input type="text" name="cabinNightly" size="4" maxlength="4" value="#cabinNightly#" /td tdWeekly Rate:/td td $ input type="text" name="cabinWeekly" size="4" maxlength="4" value="#cabinWeekly#" /td /tr tr tdBedroom 1:/td td input type="text" name="cabinBedroom1" maxlength="50" value="#cabinBedroom1#" /td tdBedroom 2:/td td input type="text" name="cabinBedroom2" maxlength="50" value="#cabinBedroom2#" /td /tr tr tdBedroom 3:/td td input type="text" name="cabinBedroom3" maxlength="50" value="#cabinBedroom3#" /td tdBedroom 4:/td td input type="text" name="cabinBedroom4" maxlength="50" value="#cabinBedroom4#" /td /tr tr tdBedroom 5:/td td input type="text" name="cabinBedroom5" maxlength="50" value="#cabinBedroom5#" /td tdSleep Sofa:/td td input type="text" name="cabinSleepsofa" maxlength="50" value="#cabinSleepsofa#" /td /tr tr tdLoft:/td td input type="text" name="cabinLoft" maxlength="50" value="#cabinLoft#" /td tdDishwasher:/td tdinput type="checkbox" name="cabinDishwasher" value="#cabinDishwasher#"/td /tr tr tdMicrowave:/td tdinput type="checkbox" name="cabinMicrowave" value="#cabinMicrowave#"/td tdAir Conditioning:/td tdinput type="checkbox" name="cabinAC" value="#cabinAC#"/td /tr tr tdStereo/CD Player:/td tdinput type="checkbox" name="cabinStereoCD" value="#cabinStereoCD#"/td tdTV:/td td input type="text" name="cabinTV" maxlength="50" value="#cabinTV#" /td /tr tr tdVCR:/td tdinput type="checkbox" name="cabinVCR" value="#cabinVCR#"/td tdWasher/Dryer:/td td input type="text" name="cabinWashdry" maxlength="50" value="#cabinWashdry#" /td /tr tr tdDeck/Porch:/td tdinput type="checkbox" name="cabinDeckporch" value="#cabinDeckporch#"/td tdGrill:/td td input type="text" name="cabinGrill" maxlength="50"
Thank you!
To all who helped with my problem - very quickly, and consistently! - Corina, Jason, James, David, Nathan, Peter, Frank, Alec, and Kelly - thank you *very* much! It worked perfectly for me. What a great list. P@tty Ayers Dreamweaver Resources, FAQs, and Tutorials: http://www.thepattysite.com/dreamweaver/ Carolina Web Solutions http://www.carolinawebsolutions.com "Design in art, is a recognition of the relation between various things, various elements in the creative flux. You can't invent a design. You recognise it, in the fourth dimension. That is, with your blood and your bones, as well as with your eyes." - D. H. Lawrence "Well-behaved women seldom make history." - Anonymous ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists