Checking form info
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[AnswerHeadingAnswers] CFSET Form.AnswerValue=Form[AnswerValueAnswers] CFSET Form.AnswerID=Form[AnswerIDAnswers] 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[AnswerValueAnswers] Any ideas would be appreciated. T __ Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm 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
RE: Checking form info
What is it your trying to do in the cfsets? Structure? Ade -Original Message- From: Thane Sherrington [mailto:[EMAIL PROTECTED]] Sent: 29 July 2002 16:33 To: CF-Talk Subject: Checking form info 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[AnswerHeadingAnswers] CFSET Form.AnswerValue=Form[AnswerValueAnswers] CFSET Form.AnswerID=Form[AnswerIDAnswers] 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[AnswerValueAnswers] Any ideas would be appreciated. T __ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm 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
Re: Checking form info
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[AnswerHeadingAnswers] CFSET Form.AnswerValue=Form[AnswerValueAnswers] CFSET Form.AnswerID=Form[AnswerIDAnswers] 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[AnswerValueAnswers] 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
RE: Checking form info
To get the IsDefined() to work, try this: CFIF IsDefined(Form.AnswerValue#Answers#) Chris Lofback Sr. Web Developer TRX Integration 28051 US 19 N., Ste. C Clearwater, FL 33761 www.trxi.com -Original Message- From: Thane Sherrington [mailto:[EMAIL PROTECTED]] Sent: Monday, July 29, 2002 11:33 AM To: CF-Talk Subject: Checking form info 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[AnswerHeadingAnswers] CFSET Form.AnswerValue=Form[AnswerValueAnswers] CFSET Form.AnswerID=Form[AnswerIDAnswers] 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[AnswerValueAnswers] Any ideas would be appreciated. T __ Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm 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