I am working on my UDF for checking a form. I have several fields that are
required and other error checking methods to make sure e mail is correct and
birthdate is enter in the right format etc etc.
The problem I am having is finding out if a certain structure exists in my
array. If it does I want to hightlight the field and display a message. I
have attached the code below. I really need some help with this.
TIA
<!--- Process Form and Set Errors If No errors occur process form and move
to location --->
<!--- Are required fields filled in --->
<cffunction name="reqiredfields" returntype="array">
<!--- validate your inputs, set Variables.ErrorText if
anything failes --->
<cfif not len(form.city) or not len(form.country)
or not len(form.mgender) or not len(form.dob1) or not len(form.title) or not
len(form.message) or not len(form.yold) or not len(form.mold)
<-- If Error is found, create an Array of Structures --->
<Cfset emessage = ArrayNew(1)>
<Cfset emessage [1] = StructNew()>
<Cfset emessage[1].ecode = "main">
<cfset emessage[1].edisplay = "Required fields are
blank">
<!--- No City --->
<cfelseif form.city is "">
<Cfset emessage [2] = StructNew()>
<Cfset emessage[2].ecode = "city">
<cfset emessage[2].edisplay = "You must
fill in your city">
</Cfif>
<cfreturn emessage>
</cffunction>
<CFIF form.process AND ArrayLen(reqiredfields()) GT 0>
<cfhtmlhead text="<meta name=""Description""
content=""Free personal ads"">
<link rel=""STYLESHEET"" type=""text/css"" href=""style.css"">
<title>XPERONALADS - Sign Up Form - Error</title>">
<Cfelse>
<cfhtmlhead text="<meta name=""Description""
content=""Free personal ads"">
<link rel=""STYLESHEET"" type=""text/css"" href=""style.css"">
<title>XPERONALADS - Sign Up Form </title>">
</CFIF>
<!--- If something failed, tell the user what it was --->
<CFIF form.process AND ArrayLen(reqiredfields()) GT 0>
<Caption align="center" valign="top"
class="error"><cfoutput>#emessage[1].edisplay#</cfoutput></Caption>
<cfelse>
<Caption align="center" valign="top" class="error">All fields
marked with * are required</Caption>
</CFIF>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Purchase from House of Fusion, a Macromedia Authorized Affiliate and support the CF
community.
http://www.houseoffusion.com/banners/view.cfm?bannerid=35
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:182066
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54