> I have a form with with 5 text fill ins, and I want to check to see if > some > aren't entered. For instance, I might have Field 1,2, and 5 filled in and > 3 and 4 blank. I was using code like this: > <CFLOOP index="Answers" from="1" to="5" step="1"> > <CFSET Form.AnswerHeading=Form["AnswerHeading"&Answers]> > <CFSET Form.AnswerValue=Form["AnswerValue"&Answers]> > <CFSET Form.AnswerID=Form["AnswerID"&Answers]>
> To get the data from the form fields, but if the field is blank this > crashes, and I can't get an IsDefined to work - I was using this: > <CFIF IsDefined("Form["AnswerValue"&Answers]"> > Any ideas would be appreciated. Yea, you don't want to use array notation with IsDefined() generally speaking ... although the syntax above is broken anyway... You would need to use single-quotes within the double-quotes of the IsDefined() for the array notation on the form, and you need to close the isdefined() parenthesis on the end... however... generally speaking, if you want to check to see if a form parameter is defined, I would use <cfif isdefined("form.AnswerValue#answers#")> and just make sure none of your form field names contain any special characters like hyphens. If you really need a hypen, you can check the keys of the form structure with something like this <cfif ListFindNoCase(StructKeyList(form),"AnswerValue#answers#")> Otherwise, as a general rule, rather than using IsDefined(), I would use a <cfparam> tag to ensure that the form variable exists ( again, avoid special characters ) ... <cfparam name="form.AnswerValue#answers#" type="string" value=""> And remember to double-check your form fields with the CF debugging output... if necessary use <cfsetting showdebugoutput="yes"> at the top of your page -- although I think you still have to have your ip address in the cfadmin's debugging ip's for that to work. hth Isaac Dealey Certified Advanced ColdFusion Developer www.turnkey.to 954-776-0046 ______________________________________________________________________ This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. 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