This content has been marked as final. Show 3 replies
I didn't visit your page. The subject line suggests that you are trying to do form validation in an application.cfc file. Bad idea. Do it in another file somewhere.
Hey.. Not sure what happened to my 2 points above. The preview looked fine before I submitted it. Weird!
Thanks for your reply Dan.
This (amongst other code) is what they put in there:
<cffunction name="onError" returntype="void">
<cfargument name="exception" required="true" />
<cfargument name="eventName" type="String" required="true" />
<cfif isDefined('exception.StackTrace') AND isDefined('exception.errors')
AND exception.StackTrace contains 'coldfusion.filter.FormValidationException'>
<cfset session.validationError = exception.errors />
<cfset session.stFormData = duplicate( form ) />
<cflocation url="#cgi.HTTP_REFERER#" addtoken="false" />
<cfthrow object="#exception#" />
So,why would this be a bad idea?
- - - -
Oh, and if the above code makes it ok to add to Application.cfc, then my quesitons 1 and 2 were:
1. The validation errors return in different orders every time the form is posted, and was wondering how to control this.
2. I couldn't get the form to post any values.
> The validation errors return in different orders every time the form is posted, and was wondering how to control this.
You can't. That's one of the downsides of using cfform validation.
As to why your form didn't post any values, you're going to need to post your form code (from <cfform...> to </cfform>)