something seem s odd about ur logic here.  For one, ehy wrap the UDF
in the form.process check?  Maybe try it like below.  You had a
argument for teh UDF too, but not using it.  Is form.process a form
control ?   If nothing else, this direction below may lead you to
something fruitful...HTH

<CFPARAM NAME="Form.Process" DEFAULT="FALSE">

<!--- 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">

                                                            </Cfif>

                                    <cfreturn emessage>

                                    </cffunction>

                        

<CFIF form.process AND ArrayLen(reqiredfields()) GT 0>
   <link rel=""STYLESHEET"" type=""text/css"" href=""> <title> Sign Up Form - Error</title>">

<Cfelse>
    <link rel=""STYLESHEET"" type=""text/css"" href="">
<title>Sign Up Form </title>">

</CFIF>

Doug

On Sun, 17 Oct 2004 14:11:12 -0700, Harold Brauer <[EMAIL PROTECTED]> wrote:
> I am working on this UDF, making an array of structures so that if there is
> an error on my form it will send the user back, highlight the fields that
> need to be filled in and display an error message. The problem I am having
> is that the Array is being set BEFORE the form is processed. The form is
> being submitted back to itself as you can see in the code below. Can anyone
> tell me what I am doing wrong?
>
> <CFPARAM NAME="Form.Process" DEFAULT="FALSE">
>
> <!--- Process Form and Set Errors If No errors occur  process form and move
> to location --->
>
>                         <CFIF Form.Process>
>
>                         <!--- Are required fields filled in --->
>
>                                     <cffunction name="reqiredfields"
> returntype="array">
>
>                                     <cfargument name="fields" default=""
> required="yes">
>
>                                      <!--- 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">
>
>                                                             </Cfif>
>
>                                     <cfreturn emessage>
>
>                                     </cffunction>
>
>                         </cfif>
>
> <CFIF ArrayLen(reqiredfields()) GT 0>
>    <link rel=""STYLESHEET"" type=""text/css"" href=""> > <title> Sign Up Form - Error</title>">
>
> <Cfelse>
>     <link rel=""STYLESHEET"" type=""text/css"" href=""> >
> <title>Sign Up Form </title>">
>
> </CFIF>________________________________
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to