I know... im being lazy.  :)  CFINSERT spoiled me but i have run into to 
many problems with the function.

I have found a good way of making all the logic.  I grab the comma 
delimited list of variables from the debugging output.  Place the comma 
delimited list in CF Studio, and do Extended Find Replace to modify the list.

I find ,

and replace it with

,<cfif VAR is not "">


Then i find ,

and replace it with

</cfif>,

It will turn a list like
FILENAME ,DIM ,CONFIG
into
<cfif FILENAME is not "">FILENAME</cfif>,
<cfif DIM is not "">DIM</cfif>,
<cfif CONFIG is not "">CONFIG</cfif>,

Kinda Cool!  :)




At 04:53 PM 11/13/2001 -0800, you wrote:
>I know this doesn't make it any less work, but you should be doing this
>anyway to make sure you aren't inserting bad data. Check whether it exists,
>then check that it's the right datatype, then check the range/length. Never
>trust anything sent from the browser.
>
>Also, I believe the preferred method of checking for empty strings is
><cfif not Len(form.var)> - I think it's faster than string comparison.
>
>Can you use a default value in the database for the checkbox/radio buttons
>and not insert them if they aren't checked in the form? (won't work for text
>fields, since as you said they default to empty string)
>
>Eric
>
>-----Original Message-----
>From: Chad Gray [mailto:[EMAIL PROTECTED]]
>Sent: Tuesday, November 13, 2001 4:32 PM
>To: CF-Talk
>Subject: RE: SQL INSERT
>
>
>If the text input is left blank on the form then when it is passed to the
>action page is has a value of ""
>
>Since it has a value the <cfparam> is not kicking in.  I would have to
>write logic like Bryan mentioned.
>
><cfif form.numberVar3 IS ""><cfset form.numberVar3 = "NULL"></cfif>
>
>none of the radio buttons or check boxes are numbers.  They are text.
>
>
>
>At 01:20 PM 11/14/2001 +1300, you wrote:
> >so you're saying when you don't select a checkbox then it's setting the var
> >to "" ?
> >
> >-----Original Message-----
> >From: Chad Gray [mailto:[EMAIL PROTECTED]]
> >Sent: Wednesday, 14 November 2001 1:19 p.m.
> >To: CF-Talk
> >Subject: RE: SQL INSERT
> >
> >
> >So such luck.  Since the form is defining the var to "" the <cfparam ...
> >default="0"> is not taking effect.
> >
> >Guess i will just have to write the <CFIF> logic that Bryan was talking
> >about.  This sucks since i have about 30 inputs to check.
> >
> >Thanks everyone!
> >
> >
> >
> >At 07:11 PM 11/13/2001 -0500, you wrote:
> > >Some of them are.... i will try this.  Thanks.
> > >
> > >At 01:03 PM 11/14/2001 +1300, you wrote:
> > > >The fields that you're inserting into wouldn't happen to be number
>fields
> > > >would they?
> > > >
> > > >if so you might want to do <cfparam name="form.var" default="0">
> > > >
> > > >-----Original Message-----
> > > >From: Chad Gray [mailto:[EMAIL PROTECTED]]
> > > >Sent: Wednesday, 14 November 2001 12:50 p.m.
> > > >To: CF-Talk
> > > >Subject: SQL INSERT
> > > >
> > > >
> > > >This seems like such a beginner question, but can you use INSERT INTO
> >with
> > > >form fields that are left blank?  ( i am using <cfparam name="form.var"
> > > >default=""> for the radio buttons, and check boxes on the action page )
> > > >
> > > >Im getting a "Syntax error in INSERT INTO statement".  THe statement
> >works
> > > >fine if all the fields in the form are filled out.  If i submit the
>form
> > > >with all blanks i get this error.
> > > >
> > > >The resulting SQL statement looks something like this on the action
>page:
> > > >
> > > >SQL =
> > > >INSERT INTO products (FILENAME,DIM,CONFIG)
> > > >VALUES ('',,'')
> > > >
> > > >This is with a MS Access database also.
> > > >
> > > >DO i have to have to do:
> > > >INSERT INTO products (<CFIF form.var is not "">FILENAME</CFIF>)
> > > >VALUES (<CFIF form.var is not "">#form.filename#</CFIF>)
> > > >
> > > >I hope not!
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> >
> >
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to