nothin ;-) throw a <cfif ListLen(attributes.chkOption)> before your loop
Bryan Stevenson B.Comm. VP & Director of E-Commerce Development Electric Edge Systems Group Inc. t. 250.920.8830 e. [EMAIL PROTECTED] --------------------------------------------------------- Macromedia Associate Partner www.macromedia.com --------------------------------------------------------- Vancouver Island ColdFusion Users Group Founder & Director www.cfug-vancouverisland.com ----- Original Message ----- From: "Douglas Brown" <[EMAIL PROTECTED]> To: "CF-Talk" <[EMAIL PROTECTED]> Sent: Tuesday, July 02, 2002 11:05 AM Subject: Re: Working with empty lists > I guess the problem is that since the chkOption value IS "" that the loop does > not even begin to process. Is that a true thing? > > If I say > > <cfparam name="attributes.chkOption" default=""> > > and then a list > > <cfloop list="#attributes.chkOption#" index="j" delimiters=","> > > What happens? > > > Douglas Brown > Email: [EMAIL PROTECTED] > ----- Original Message ----- > From: "BEN MORRIS" <[EMAIL PROTECTED]> > To: "CF-Talk" <[EMAIL PROTECTED]> > Sent: Tuesday, July 02, 2002 10:52 AM > Subject: Re: Working with empty lists > > > > If you are using MS SQL, you can use NULLIF which will insert NULL if it is > an empty string: > > > > INSERT INTO mytable (field1) > > VALUES ( NULLIF('#var#', '') ) > > > > >>> "Bryan Stevenson" <[EMAIL PROTECTED]> 07/02/02 01:42PM >>> > > I always CFPARAM the checkbox var to blank (default=""). Then I add a case > statement to where I'm > > going to add it; > > > > <cfif NOT len(MyCheckboxVar)> > > NULL, > > <cfelse> > > #MyCheckboxVar# > > </cfif> > > > > I think your method evaluates attributes.chkOption to a string of NULL and > not a NULL value ;-) > > > > HTH > > > > Bryan Stevenson B.Comm. > > VP & Director of E-Commerce Development > > Electric Edge Systems Group Inc. > > t. 250.920.8830 > > e. [EMAIL PROTECTED] > > > > --------------------------------------------------------- > > Macromedia Associate Partner > > www.macromedia.com > > --------------------------------------------------------- > > Vancouver Island ColdFusion Users Group > > Founder & Director > > www.cfug-vancouverisland.com > > > > ----- Original Message ----- > > From: "Douglas Brown" <[EMAIL PROTECTED]> > > To: "CF-Talk" <[EMAIL PROTECTED]> > > Sent: Tuesday, July 02, 2002 10:32 AM > > Subject: Working with empty lists > > > > > > > I have a group of checkboxes that I am converting into a list, but I > > > would like it to where if the person does not check any of the boxes, > > > that it at least puts the value of NULL into the DB. As you can see I > > > have tried <cfparam> but that does not work for lists I suppose. > > > > > > <cfparam name="attributes.chkOption" default="NULL"> > > > > > > <!---Insert the options into the options table//---> > > > <cfloop list="#attributes.chkOption#" index="j" delimiters=","> > > > <cfquery datasource="#request.site.dsn#" name="insert_options"> > > > DECLARE @maxid int > > > BEGIN > > > SELECT @maxid = MAX(ID) > > > FROM options > > > IF @maxid IS NULL > > > SELECT @maxid = 1 > > > ELSE > > > SELECT @maxid = @maxid + 1 > > > END > > > > > > DECLARE @max_inv_id int > > > BEGIN > > > SELECT @max_inv_id = MAX(ID) > > > FROM inventory > > > END > > > INSERT INTO options ( id, > > > inventory_id, > > > option_id ) > > > > > > VALUES ( @maxid, > > > @max_inv_id, > > > #j# ) > > > > > > > > > </cfquery> > > > </cfloop> > > > > > > > > > > > > > > > Douglas Brown > > > Email: [EMAIL PROTECTED] > > > > > > > > > > > ______________________________________________________________________ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists