I don't know if you've sloved your problem or not, but
here is another solution:
<cfquery datasoure="#ds#">
Insert into DatabaseTable (<cfif
Len(#Trim(FormField)#) NEQ 0>FormField</cfif>)

Values (<cfif Len(#Trim(FormField)#) NEQ
0>#FormFieldValue#</cfif>)
</cfquery>

Hope this helps!

--- Bill Davidson <[EMAIL PROTECTED]> wrote:
> Test it see if is blank or undefined with a cfif
> block in your SQL.
> Something like:
> 
>  <CFQUERY Name="update_query"
> datasource="#application.dsn#">
> 
>  Update table_name
>  Set
> <cfif isDefined("form.MiddleInit ") and
> form.MiddleInit is not "">
>     MiddleInit = '#form.MiddleInit #',
> </cfif>
> field = form.field
> ....
>  Where
> ....
> </cfquery>
> 
> -Bill
> www.brainbox.tv
> 
> ----- Original Message -----
> From: "Hubert Earl" <[EMAIL PROTECTED]>
> To: "CF-Talk" <[EMAIL PROTECTED]>
> Sent: Saturday, April 28, 2001 7:05 PM
> Subject: How can I get CF to ignore a form field
> with no data?
> 
> 
> > Hi,
> >
> > How can I get CF to ignore a form field with no
> data? I have a form with a
> field called MiddleInit which will not always be
> filled in.  At the moment,
> however, an error message is generated if that field
> is blank.
> >
> > Sincerely,
> > ---
> > Hubert Earl
> >
> > ICQ#: 16199853
> > AIM: hubertfme
> >
> > My Jamaican Art, Craft & More Online Store:
>
http://www.angelfire.com/ny/hearl/link_page_on_angelfire.html
> >
> >
> >
> >
> >
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to