RE: problem looping around form fields and values
Hi Mark, Here you go: You have to first construct the exact the fully scoped variable name. You can see I added the CFSET Fname = Form. fname Line and then you use the evaluate function to return the actual value of the passed variable name. Corrected Code Attached: cfset fieldlist=mailone,mail2,mail3,mail4,mail5,mail6,mail7,mail8,mail9,mail10 CFLOOP LIST=#fieldlist# INDEX=fname CFSET Fname = Form. fname CFIF #fname# IS NOT cfsetting enablecfoutputonly=yes cfparam name=ReturnCode default=0 cfset sEmailRE = ^([a-zA-Z0-9\.]+)\@([a-zA-Z0-9\.\-]+)\.([a-zA-Z]{2,3})$ cfif ReFindNoCase(sEmailRE,#evaluate(fname)#) cfset ReturnCode = 1 /cfif cfsetting enablecfoutputonly=no CFIF returncode IS 0 Error message CFELSE Continue /CFIF /CFIF /CFLOOP ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: problem looping around form fields and values
Hi Ben, Thanks for the explanation!! The code works great on the first field (mailone), but then doesn't check any of the remaining fields. It loops through them, but seems any form variable after the first is not being checked by the REFindNoCase function because it lets any combination of text go through. I've never used this email checking function on more than one form field at a time, but the loop function seems to be ok. Hmmm .. strange. Any thoughts on this? Thanks again! Mark --- Ben Koshy [EMAIL PROTECTED] wrote: Hi Mark, Here you go: You have to first construct the exact the fully scoped variable name. You can see I added the CFSET Fname = Form. fname Line and then you use the evaluate function to return the actual value of the passed variable name. Corrected Code Attached: cfset fieldlist=mailone,mail2,mail3,mail4,mail5,mail6,mail7,mail8,mail9,mail10 CFLOOP LIST=#fieldlist# INDEX=fname CFSET Fname = Form. fname CFIF #fname# IS NOT cfsetting enablecfoutputonly=yes cfparam name=ReturnCode default=0 cfset sEmailRE = ^([a-zA-Z0-9\.]+)\@([a-zA-Z0-9\.\-]+)\.([a-zA-Z]{2,3})$ cfif ReFindNoCase(sEmailRE,#evaluate(fname)#) cfset ReturnCode = 1 /cfif cfsetting enablecfoutputonly=no CFIF returncode IS 0 Error message CFELSE Continue /CFIF /CFIF /CFLOOP ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: problem looping around form fields and values
Change cfparam name=ReturnCode default=0 to cfset ReturnCode=0 -David On Thursday, May 24, 2001 1:09 AM, Mark [SMTP:[EMAIL PROTECTED]] wrote: Hi Ben, Thanks for the explanation!! The code works great on the first field (mailone), but then doesn't check any of the remaining fields. It loops through them, but seems any form variable after the first is not being checked by the REFindNoCase function because it lets any combination of text go through. I've never used this email checking function on more than one form field at a time, but the loop function seems to be ok. Hmmm .. strange. Any thoughts on this? Thanks again! Mark --- Ben Koshy [EMAIL PROTECTED] wrote: Hi Mark, Here you go: You have to first construct the exact the fully scoped variable name. You can see I added the CFSET Fname = Form. fname Line and then you use the evaluate function to return the actual value of the passed variable name. Corrected Code Attached: cfset fieldlist=mailone,mail2,mail3,mail4,mail5,mail6,mail7,mail8,mail9,mail10 CFLOOP LIST=#fieldlist# INDEX=fname CFSET Fname = Form. fname CFIF #fname# IS NOT cfsetting enablecfoutputonly=yes cfparam name=ReturnCode default=0 cfset sEmailRE = ^([a-zA-Z0-9\.]+)\@([a-zA-Z0-9\.\-]+)\.([a-zA-Z]{2,3})$ cfif ReFindNoCase(sEmailRE,#evaluate(fname)#) cfset ReturnCode = 1 /cfif cfsetting enablecfoutputonly=no CFIF returncode IS 0 Error message CFELSE Continue /CFIF /CFIF /CFLOOP ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: problem looping around form fields and values
David -- Thanks, forgot about the cfparam resetting the variable. It works fine now! Mark --- David Shadovitz [EMAIL PROTECTED] wrote: Change cfparam name=ReturnCode default=0 to cfset ReturnCode=0 -David On Thursday, May 24, 2001 1:09 AM, Mark [SMTP:[EMAIL PROTECTED]] wrote: Hi Ben, Thanks for the explanation!! The code works great on the first field (mailone), but then doesn't check any of the remaining fields. It loops through them, but seems any form variable after the first is not being checked by the REFindNoCase function because it lets any combination of text go through. I've never used this email checking function on more than one form field at a time, but the loop function seems to be ok. Hmmm .. strange. Any thoughts on this? Thanks again! Mark --- Ben Koshy [EMAIL PROTECTED] wrote: Hi Mark, Here you go: You have to first construct the exact the fully scoped variable name. You can see I added the CFSET Fname = Form. fname Line and then you use the evaluate function to return the actual value of the passed variable name. Corrected Code Attached: cfset fieldlist=mailone,mail2,mail3,mail4,mail5,mail6,mail7,mail8,mail9,mail10 CFLOOP LIST=#fieldlist# INDEX=fname CFSET Fname = Form. fname CFIF #fname# IS NOT cfsetting enablecfoutputonly=yes cfparam name=ReturnCode default=0 cfset sEmailRE = ^([a-zA-Z0-9\.]+)\@([a-zA-Z0-9\.\-]+)\.([a-zA-Z]{2,3})$ cfif ReFindNoCase(sEmailRE,#evaluate(fname)#) cfset ReturnCode = 1 /cfif cfsetting enablecfoutputonly=no CFIF returncode IS 0 Error message CFELSE Continue /CFIF /CFIF /CFLOOP ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists