try something like this. <input type="checkbox" name="cabinPets" value="#cabinPets#" <cfif #ucase(Cabinpets)# eq "YES">Checked</cfif> > Jason Lees National Express Email : [EMAIL PROTECTED] -----Original Message----- From: P@tty Ayers [mailto:[EMAIL PROTECTED]] Sent: 03 April 2001 14:22 To: CF-Talk Subject: 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> <title>Edit a Record Page</title> </head> <body bgcolor="#FFFFFF"> <!-- 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="##CCCCCC"> <tr> <td>Cabin Name:</td> <td> <input type="text" name="cabinName" maxlength="50" value="#cabinName#"> </td> <td>Location (City):</td> <td> <input type="text" name="cabinCity" maxlength="50" value="#cabinCity#"> </td> </tr> <tr> <td>Distance from Asheville:</td> <td> <input type="text" name="cabinDistance" maxlength="3" size="3" value="#cabinDistance#"> </td> <td>Number of Bedrooms:</td> <td> <input type="text" name="cabinBedrooms" maxlength="2" size="2" value="#cabinBedrooms#"> </td> </tr> <tr> <td>Number of Bathrooms:</td> <td> <input type="text" name="cabinBathrooms" maxlength="2" size="2" value="#cabinBathrooms#"> </td> <td>Sleeps:</td> <td> <input type="text" name="cabinSleeps" maxlength="2" size="2" value="#cabinSleeps#"> </td> </tr> <tr> <td>Hot tub:</td> <td> <input type="checkbox" name="cabinHottub" value="#cabinHottub#"> </td> <td>Jetted tub:</td> <td> <input type="checkbox" name="cabinJettedtub" value="#cabinJettedtub#"> </td> </tr> <tr> <td>Fireplace:</td> <td> <input type="checkbox" name="cabinFireplace" value="#cabinFireplace#"> </td> <td>Pet-friendly:</td> <td> <input type="checkbox" name="cabinPets" value="#cabinPets#"> </td> </tr> <tr> <td>Nightly Rate:</td> <td> $ <input type="text" name="cabinNightly" size="4" maxlength="4" value="#cabinNightly#"> </td> <td>Weekly Rate:</td> <td> $ <input type="text" name="cabinWeekly" size="4" maxlength="4" value="#cabinWeekly#"> </td> </tr> <tr> <td>Bedroom 1:</td> <td> <input type="text" name="cabinBedroom1" maxlength="50" value="#cabinBedroom1#"> </td> <td>Bedroom 2:</td> <td> <input type="text" name="cabinBedroom2" maxlength="50" value="#cabinBedroom2#"> </td> </tr> <tr> <td>Bedroom 3:</td> <td> <input type="text" name="cabinBedroom3" maxlength="50" value="#cabinBedroom3#"> </td> <td>Bedroom 4:</td> <td> <input type="text" name="cabinBedroom4" maxlength="50" value="#cabinBedroom4#"> </td> </tr> <tr> <td>Bedroom 5:</td> <td> <input type="text" name="cabinBedroom5" maxlength="50" value="#cabinBedroom5#"> </td> <td>Sleep Sofa:</td> <td> <input type="text" name="cabinSleepsofa" maxlength="50" value="#cabinSleepsofa#"> </td> </tr> <tr> <td>Loft:</td> <td> <input type="text" name="cabinLoft" maxlength="50" value="#cabinLoft#"> </td> <td>Dishwasher:</td> <td><input type="checkbox" name="cabinDishwasher" value="#cabinDishwasher#"></td> </tr> <tr> <td>Microwave:</td> <td><input type="checkbox" name="cabinMicrowave" value="#cabinMicrowave#"</td> <td>Air Conditioning:</td> <td><input type="checkbox" name="cabinAC" value="#cabinAC#"</td> </tr> <tr> <td>Stereo/CD Player:</td> <td><input type="checkbox" name="cabinStereoCD" value="#cabinStereoCD#"</td> <td>TV:</td> <td> <input type="text" name="cabinTV" maxlength="50" value="#cabinTV#"> </td> </tr> <tr> <td>VCR:</td> <td><input type="checkbox" name="cabinVCR" value="#cabinVCR#"</td> <td>Washer/Dryer:</td> <td> <input type="text" name="cabinWashdry" maxlength="50" value="#cabinWashdry#"> </td> </tr> <tr> <td>Deck/Porch:</td> <td><input type="checkbox" name="cabinDeckporch" value="#cabinDeckporch#"</td> <td>Grill:</td> <td> <input type="text" name="cabinGrill" maxlength="50" value="#cabinGrill#"> </td> </tr> <tr> <td>View:</td> <td> <input type="text" name="cabinView" maxlength="50" value="#cabinView#"> </td> <td>Fireplace Style:</td> <td> <input type="text" name="cabinFirestyle" maxlength="50" value="#cabinFirestyle#"> </td> </tr> <tr> <td colspan="4"> <p align="center">Description:<br> <textarea name="cabinsDescription" cols="60" rows="5">#cabinsDescription#</textarea> </p> </td> </tr> <tr> <td colspan="4"> <div align="center"> <input type="submit" value="Submit Edited Record to Database"> </div> </td> </tr> </table> </form> </cfoutput> <!-- END FORM SECTION --> </body> </html> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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: Displaying yes/no field dynamically in checkboxes?
Jason Lees (National Express) Tue, 03 Apr 2001 07:36:32 -0700
- RE: Displaying yes/no field dynamically in ... Jason Lees (National Express)
- RE: Displaying yes/no field dynamicall... James Maltby
- RE: Displaying yes/no field dynamicall... Hayes, David
- RE: Displaying yes/no field dynamicall... Peter J. MacDonald
- RE: Displaying yes/no field dynamicall... Lamon, Alec