I agree, but I still have to enter all the form field names in the <cfparam>
anyways so I'm not really gaining anything.

-----Original Message-----
From: Ben Forta [mailto:[EMAIL PROTECTED] 
Sent: October-28-08 5:32 PM
To: cf-talk
Subject: RE: Adding & Updating empty values

>> How do I get passed the "q1 is not defined in Form" CF error? All I want
to
>> do is enter an empty value. How can I allow it to do that for insert 
>> and updates?

Actually, you'd never want to have to deal with "not defined" errors in your
core code. That's what <cfparam> is for, all form fields should be defined
(default them to "" if needed) higher up, along with form field validation,
and so on.

--- Ben



-----Original Message-----
From: Gerald Guido [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 28, 2008 4:10 PM
To: cf-talk
Subject: Re: Adding & Updating empty values

Write a code generator for it.


fill out the form, and loop over the #Form.FIELDNAMES#

Like so

<pre>
<cfoutput>
<cfloop  list="#form.FIELDNAMES#" index="GO">
&lt;cfif isundefined("form.#GO#")>
     &lt;cfset form.q#GO# = "">
&lt;/cfif>
</cfloop>
</cfoutput>
</pre>



On Tue, Oct 28, 2008 at 3:46 PM, Rick Sanders <[EMAIL PROTECTED]> wrote:

> Is that the only way?
>
> It's a questionnaire form with 50 questions! You mean I have to do a
<cfif>
> for every question and assign it a blank value if there's no value!?
>
> -----Original Message-----
> From: Rob Parkhill [mailto:[EMAIL PROTECTED]
> Sent: October-28-08 4:42 PM
> To: cf-talk
> Subject: Re: Adding & Updating empty values
>
> wrap it in a <cfif> so..
> <cfif isundefined("form.q1")>
>           <cfset form.q1 = "">
> </cfif>
>
> Rob
>
> On Tue, Oct 28, 2008 at 3:33 PM, Rick Sanders <[EMAIL PROTECTED]> wrote:
>
> > Hey all,
> >
> >
> >
> > In my form some values may be left empty. For example a form field named
> > q1.
> >
> > It's fine if it's empty because the user can go back and fill it in
later
> > if
> > they wish.
> >
> >
> >
> > How do I get passed the "q1 is not defined in Form" CF error? All I want
> to
> > do is enter an empty value. How can I allow it to do that for insert and
> > updates?
> >
> >
> >
> > Thanks!
> >
> >
> >
> > LogoSig
> >
> > Rick Sanders
> >
> > Webenergy
> >
> > Canada: 902-431-7279
> >
> > USA:       919-799-9076
> >
> > Canada: www.webenergy.ca
> >
> > USA:       www.webenergyusa.com
> >
> >
> >
> >
> >
> >
> >
> >
>
>
>
> 





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:314499
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to