Re: Adding & Updating empty values
>>here is a good method Well, actually not so good: if a checkbox is not checked, its name will not appear in form.fieldnames, so the loop on fieldnames will work only on defined fileds and the http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:314555 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Adding & Updating empty values
>>I agree, but I still have to enter all the form field names in the anyways so I'm not really gaining anything. I have solved this problem once for all this way : 1. in your form page, add this JS function call onsubmit, ie: var defaultList = ""; function checkInput(formul) { if(!formul) formul = "formul"; curRadio = ""; form = document[formul]; if (form == null) return; for (var i = 0; i < form.elements.length; i++) { // create default list if (field.type && !field.disabled) { switch (field.type) { case 'radio': case 'checkbox': { if (defaultList.lastIndexOf(field.name) < 0) defaultList += "," + field.name; break; } case 'select-one': case 'select-multiple': { if (defaultList.lastIndexOf(field.name) < 0) defaultList += "," + field.name; break; } } //switch } // if } // for var inp = form.defaultList; if (!inp) { inp = document.createElement("INPUT"); inp.type = "hidden"; inp.name = "defaultList"; form.appendChild (inp); } inp.value = defaultList.substr(1); return; } This will add or update a hidden field in your form with the list of all fields in your form, empty or not. 2. in your action page, add this CF function: You can set the default value you want. ~| 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:314554 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Adding & Updating empty values
Ah! Thank you! I've been looking for resources like this! Excellent! Thank you! -Original Message- From: Gerald Guido [mailto:[EMAIL PROTECTED] Sent: October-28-08 6:27 PM To: cf-talk Subject: Re: Adding & Updating empty values Rick, It may be time to make yourself acquainted with the wonderful world of code generators. Here is a partial list of the various offerings. I make heavy use of cfcgenerator and cfcblaster. I rarely create CRUD's by hand. http://code.google.com/p/cfcgenerator/ http://completecodegen.riaforge.org/ http://beanmachine.riaforge.org/ http://mrmx.blogspot.com/2006/09/cfcblaster-simple-code-generator.html http://cfcstub.riaforge.org/ Happy coding. ~G~ 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 > 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 so.. > > > > > 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:314511 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Adding & Updating empty values
I forgot squidhead http://squidhead.riaforge.org/ On Tue, Oct 28, 2008 at 5:27 PM, Gerald Guido <[EMAIL PROTECTED]>wrote: > Rick, > It may be time to make yourself acquainted with the wonderful world of code > generators. Here is a partial list of the various offerings. I make heavy > use of cfcgenerator and cfcblaster. I rarely create CRUD's by hand. > > > http://code.google.com/p/cfcgenerator/ > http://completecodegen.riaforge.org/ > http://beanmachine.riaforge.org/ > http://mrmx.blogspot.com/2006/09/cfcblaster-simple-code-generator.html > http://cfcstub.riaforge.org/ > > > Happy coding. > > ~G~ > > -- Gerald Guido http://www.myinternetisbroken.com "Neurotics build castles in the air, psychotics live in them. My mother cleans them." -- Rita Rudner ~| 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:314509 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Adding & Updating empty values
Rick, It may be time to make yourself acquainted with the wonderful world of code generators. Here is a partial list of the various offerings. I make heavy use of cfcgenerator and cfcblaster. I rarely create CRUD's by hand. http://code.google.com/p/cfcgenerator/ http://completecodegen.riaforge.org/ http://beanmachine.riaforge.org/ http://mrmx.blogspot.com/2006/09/cfcblaster-simple-code-generator.html http://cfcstub.riaforge.org/ Happy coding. ~G~ 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 > 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 so.. > > > > > 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:314508 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Adding & Updating empty values
Be sure that one of the radio options is checked by default. Yes That way you should never get an empty radio, but the user still has to choose "yes" where appropriate. >Yup, you're right. > >It's the radio buttons that are giving me the hassle! > >text fields are defined even if they are empty. the value is simply an >empty string. > > > >is ~| 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:314507 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Adding & Updating empty values
here is a good method to add defaults for a form to the page you are posting to. NOTE: remember to remove the (name="submit") from your submit button. This way it will not be included in the form.fieldnames list. Another bug I have found is you cant name the form fields numeric as in For some reason coldfusion gets confused when trying to evaluate it and simply returns the field name and not the value. if you wish to get the value of the field use the evaluate function as so: #evaluate("#i#")# I use this method to insert into DB's without all the coding. Providing your column names are the same as your form fields. field name: #i# value: #evaluate("#i#")# >>> How do I get passed the "q1 is not defined in Form" CF error? All I want >to > >Actually, you'd never want to have to deal with "not defined" errors in your >core code. That's what is for, all form fields should be defined >(default them to "" if needed) higher up, along with form field validation, >and so on. > >--- Ben > > > >Write a code generator for it. > > >fill out the form, and loop over the #Form.FIELDNAMES# > >Like so > > > > >> > > > > > > > > >> Is that the only way? >> >> It's a questionnaire form with 50 questions! You mean I have to do a > >later ~| 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:314505 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4>
Re: Adding & Updating empty values
On Tue, Oct 28, 2008 at 1:36 PM, Rick Sanders <[EMAIL PROTECTED]> wrote: > I agree, but I still have to enter all the form field names in the > anyways so I'm not really gaining anything. Coding templates are your friend. But regardless, I offered a suggestion to solve this earlier in a message that perhaps you missed. If you are basically matching form fields against the db, just do something like this: SELECT field1, field2, field3 FROM footable WHERE 0=1 ~| 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:314502 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Adding & Updating empty values
well, is shorter than: do stuff especially over 50 iterations :) On Tue, Oct 28, 2008 at 1:36 PM, Rick Sanders <[EMAIL PROTECTED]> wrote: > I agree, but I still have to enter all the form field names in the > > 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 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 > > > > > <cfif isundefined("form.#GO#")> > <cfset form.q#GO# = ""> > </cfif> > > > > > > > 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 > > > 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 so.. > > > > > > > > > > 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:314501 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Adding & Updating empty values
I agree, but I still have to enter all the form field names in the 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 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 <cfif isundefined("form.#GO#")> <cfset form.q#GO# = ""> </cfif> 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 > 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 so.. > > > > > 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
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 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 <cfif isundefined("form.#GO#")> <cfset form.q#GO# = ""> </cfif> 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 > 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 so.. > > > > > 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:314498 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Adding & Updating empty values
Yup, you're right. It's the radio buttons that are giving me the hassle! -Original Message- From: Charlie Griefer [mailto:[EMAIL PROTECTED] Sent: October-28-08 5:14 PM To: cf-talk Subject: Re: Adding & Updating empty values text fields are defined even if they are empty. the value is simply an empty string. On Tue, Oct 28, 2008 at 12:58 PM, Rick Sanders <[EMAIL PROTECTED]> wrote: > I hear you, and already did that for checkboxes. But, I have text fields > and > radio buttons in my form! > > > -Original Message- > From: Jason Fisher [mailto:[EMAIL PROTECTED] > Sent: October-28-08 4:47 PM > To: cf-talk > Subject: Re: Adding & Updating empty values > > The other option is to use "yes" and "no" radio buttons instead of > checkboxes, where the radio buttons default to "no". That way, the field > always exists, but you still get the difference between 1 and 0. Checkbox > that is unchecked really doesn't exist in the POST, so the CFIF solution is > pretty much required otherwise, yes. > > > > >Is that the only way? > > > >It's a questionnaire form with 50 questions! You mean I have to do a > > >for every question and assign it a blank value if there's no value!? > > > >wrap it in a so.. > > > > > > > > > >Rob > > > > > > > >to > > > > ~| 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:314490 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Adding & Updating empty values
then it looks as though there are a lot of CFIFs in your future. of course, if you are returning results in the format shown ie q1, q2, q3, you could throw it all into a loop and use an Evaluate statement to build the q# portion Rob On Tue, Oct 28, 2008 at 3:58 PM, Rick Sanders <[EMAIL PROTECTED]> wrote: > I hear you, and already did that for checkboxes. But, I have text fields > and > radio buttons in my form! > > > -Original Message- > From: Jason Fisher [mailto:[EMAIL PROTECTED] > Sent: October-28-08 4:47 PM > To: cf-talk > Subject: Re: Adding & Updating empty values > > The other option is to use "yes" and "no" radio buttons instead of > checkboxes, where the radio buttons default to "no". That way, the field > always exists, but you still get the difference between 1 and 0. Checkbox > that is unchecked really doesn't exist in the POST, so the CFIF solution is > pretty much required otherwise, yes. > > > > >Is that the only way? > > > >It's a questionnaire form with 50 questions! You mean I have to do a > > >for every question and assign it a blank value if there's no value!? > > > >wrap it in a so.. > > > > > > > > > >Rob > > > > > > > >to > > > > ~| 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:314489 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Adding & Updating empty values
text fields are defined even if they are empty. the value is simply an empty string. On Tue, Oct 28, 2008 at 12:58 PM, Rick Sanders <[EMAIL PROTECTED]> wrote: > I hear you, and already did that for checkboxes. But, I have text fields > and > radio buttons in my form! > > > -Original Message- > From: Jason Fisher [mailto:[EMAIL PROTECTED] > Sent: October-28-08 4:47 PM > To: cf-talk > Subject: Re: Adding & Updating empty values > > The other option is to use "yes" and "no" radio buttons instead of > checkboxes, where the radio buttons default to "no". That way, the field > always exists, but you still get the difference between 1 and 0. Checkbox > that is unchecked really doesn't exist in the POST, so the CFIF solution is > pretty much required otherwise, yes. > > > > >Is that the only way? > > > >It's a questionnaire form with 50 questions! You mean I have to do a > > >for every question and assign it a blank value if there's no value!? > > > >wrap it in a so.. > > > > > > > > > >Rob > > > > > > > >to > > > > ~| 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:314487 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Adding & Updating empty values
Use cfparam for all of your form fields, that way they exist for certain, and param them to an empty string (or 0 in the case of numbers). Actually, I tend to param them all to an empty string and then your sql query param fields will turn the empty string into an int/numeric for you (you are using them, right?). And if you decide that typing out the field names in the cfparams is too troublesome, you could always do a select against the table in a query, then loop over the column names in and do your cfparam in a loop dynamically. Judah On Tue, Oct 28, 2008 at 12:58 PM, Rick Sanders <[EMAIL PROTECTED]> wrote: > I hear you, and already did that for checkboxes. But, I have text fields and > radio buttons in my form! > > > -Original Message- > From: Jason Fisher [mailto:[EMAIL PROTECTED] > Sent: October-28-08 4:47 PM > To: cf-talk > Subject: Re: Adding & Updating empty values > > The other option is to use "yes" and "no" radio buttons instead of > checkboxes, where the radio buttons default to "no". That way, the field > always exists, but you still get the difference between 1 and 0. Checkbox > that is unchecked really doesn't exist in the POST, so the CFIF solution is > pretty much required otherwise, yes. > > > >>Is that the only way? >> >>It's a questionnaire form with 50 questions! You mean I have to do a >>for every question and assign it a blank value if there's no value!? >> >>wrap it in a so.. >> >> >> >> >>Rob >> >> >> >>to > > > > ~| 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:314486 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Adding & Updating empty values
Well, then isDefined("form.q1") or structKeyExists(form, "q1") should both be true, whether or not q1 is blank. If you're getting the not defined error for a text input, then something else is going on ... is there a redirect or a layer of translation between the post and the processing or some layer that's not able to 'see' the form scope? >I hear you, and already did that for checkboxes. But, I have text fields and >radio buttons in my form! > > >The other option is to use "yes" and "no" radio buttons instead of >checkboxes, where the radio buttons default to "no". That way, the field >always exists, but you still get the difference between 1 and 0. Checkbox >that is unchecked really doesn't exist in the POST, so the CFIF solution is >pretty much required otherwise, yes. ~| 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:314484 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Adding & Updating empty values
Write a code generator for it. fill out the form, and loop over the #Form.FIELDNAMES# Like so <cfif isundefined("form.#GO#")> <cfset form.q#GO# = ""> </cfif> 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 > 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 so.. > > > > > 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:314483 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Adding & Updating empty values
I hear you, and already did that for checkboxes. But, I have text fields and radio buttons in my form! -Original Message- From: Jason Fisher [mailto:[EMAIL PROTECTED] Sent: October-28-08 4:47 PM To: cf-talk Subject: Re: Adding & Updating empty values The other option is to use "yes" and "no" radio buttons instead of checkboxes, where the radio buttons default to "no". That way, the field always exists, but you still get the difference between 1 and 0. Checkbox that is unchecked really doesn't exist in the POST, so the CFIF solution is pretty much required otherwise, yes. >Is that the only way? > >It's a questionnaire form with 50 questions! You mean I have to do a >for every question and assign it a blank value if there's no value!? > >wrap it in a so.. > > > > >Rob > > > >to ~| 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:314479 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Adding & Updating empty values
Or use radio buttons, so that your values always exist in the post method of the form. Rob 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 > 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 so.. > > > > > 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:314475 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Adding & Updating empty values
The other option is to use "yes" and "no" radio buttons instead of checkboxes, where the radio buttons default to "no". That way, the field always exists, but you still get the difference between 1 and 0. Checkbox that is unchecked really doesn't exist in the POST, so the CFIF solution is pretty much required otherwise, yes. >Is that the only way? > >It's a questionnaire form with 50 questions! You mean I have to do a >for every question and assign it a blank value if there's no value!? > >wrap it in a so.. > > > > >Rob > > > >to ~| 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:314473 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Adding & Updating empty values
Is that the only way? It's a questionnaire form with 50 questions! You mean I have to do a 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 so.. 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:314467 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Adding & Updating empty values
wrap it in a so.. 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:314465 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4