1) Use a structure to store validation results.
2) Pass this struct back to firstpage incase there are errors
3) Write a css style for highlight say .error {color: red;}
3) Use conditional statement in your html tags to fire this class if the error
structure exists. Eg. Text1: <input type="text" name="txt1" <cfif
StructKeyExist(REQUEST, "stErrors")>class = "error"</cfif><br />
Chrz
> Hi All,
>
> I have to validate the form fields form and validation of form fields
> are in two different pages and it suppose to be like this. I cannot
> merge it into two pages ... I am validating the form fields and
> sending the error message back to firstpage.cfm. I can sucessfully
> display the error message at the top of the form but unable to
> highight the error fields in it.
>
> firstpage.cfm
>
> <html>
> <body>
> <cfif isdefined("url.invalidfield") and url.invalidfield neq "">
> Following fields are incorrect:
> <ul>
> <cfloop index="i" list="#invalidfield#" delimiters=",">
> <cfoutput>
> <li>#i#</li>
> </cfoutput>
> </cfloop>
> </ul>
> </cfif>
> <form name="f1" method="post" action="secondpage.cfm">
> Text1: <input type="text" name="txt1" /><br />
> Text2: <input type="text" name="txt2" /><br />
> Text3: <input type="text" name="txt3" /><br />
> <input type="submit" />
> </form>
> </body>
> </html>
>
> <!--- here is the webservice response so just using some condition
> here --->
> Secondpage.cfm
>
> <html>
> <body>
>
> <cfif form.txt1 neq "Text1">
> <cfset lstinvalidfileds = ListAppend(lstinvalidfileds, "Error in
> txt1")>
> </cfif>
> <cfif form.txt2 neq "Text2">
> <cfset lstinvalidfileds = ListAppend(lstinvalidfileds, "Error in
> txt2")>
> </cfif>
> <cfif form.txt3 neq "Text3">
> <cfset lstinvalidfileds = ListAppend(lstinvalidfileds, "Error in
> txt3")>
> </cfif>
> <cfoutput>#ListLen(lstinvalidfileds)#</cfoutput>
> <cfif ListLen(lstinvalidfileds) gt 0>
> <cflocation url="firstpage.cfm?invalidfield=#lstinvalidfileds#">
> <cfelse>
> <cflocation url = "thirdpage.cfm">
> </cfif>
> </body>
> </html>
>
> Can anyone help me out with this ...?
>
> Thanks,
> Priya
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320819
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4