At iaffectTV, we use separate err_ files to do error
checking. However, our situation is a little different
as we also totally separate out our admin and public
side apps. We are not in the situation of reusing act
files very often. If we do have a file reused a lot,
we stick it in the commonfiles dir.

We do same page error display and try to steer clear
of ugly javascript error checking. A simple error
check fuse would look like this:

<cfcase value="insert">
<cfinclude template="err_insert.cfm">
  <cfif len(errormessage)>
   <cfset rfa.insert="insert">
   <cfinclude template="qry_categoriesgetall.cfm">
   <cfinclude template="dis_inputform.cfm">
  <cfelse>
   <cfinclude template="act_insert.cfm">
   <cflocation url="index.cfm?fuseaction=thanks"
addtoken="no">
  </cfif>
</cfcase>

Basically, if the var errormessage has a length after
you come out of err_insert.cfm, then you know you have
an error and need to redisplay the form, outputting
the errormessage. Otherwise you are good to go and can
insert.

HTH,

Nate
iaffectTV.com

--- Patrick McElhaney <[EMAIL PROTECTED]>
wrote:
> I usually perform validation in the fuse that uses
> the data. This makes the fuse more independant. The
> way I look at it, you need to tie validation to
> either
> the form, the act_ file, or the fuseaction. Tying it
> to the fuseaction would create so many validation
> files
> it may end up defeating the purpose. Tying it to the
> form works, but what if you need to validate data
> that
> doesn't come from a form?
> 
> I usually try to put as much user-friendly
> validation in
> the form as possible. I use javascript where
> acceptable,
> and constrain input as much as possible with
> select/option/checkboxes. As a back up, I add a
> minimal
> amount of validation to the act_ files. Where
> possible,
> I don't worry about the validation and just trap
> errors.
> 
> Patrick
> 
> 
> > -----Original Message-----
> > From: Reid Hankins [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, January 08, 2001 5:27 PM
> > To: Fusebox
> > Subject: Form Validation and Fusebox
> >
> >
> > I'm new to this forum so I hope this isn't an old
> topic, but would be
> > interested to hear different approaches to form
> validation.  I have tried
> > looking into the archives on this subject, but
> haven't found too much...
> >
> > I have spent a lot of time working on a system to
> keep the form validation
> > as seperate from the action files that actually
> save/update the form input
> > as possible.  It seems to me that to promote
> modularity, form
> > validation has
> > to be generic enough that the action file that
> saves the input
> > could be used
> > by different forms.
> >
> > For example, say I have an admin form which posts
> to
> > fuseaction=adminformsave and a regular user form
> that posts to
> > fuseaction=formsave.  If the action of saving each
> form's info is
> > the same,
> > I would want to reuse the same action file. 
> However, if I want
> > to add some
> > type of form validation, I would NOT want to
> include that in the
> > act_formsave.cfm, or at least not include any
> redirections back
> > to a form in
> > that file.   Instead I would need some other
> module or some other way to
> > handle it to keep it modular.  I would think this
> would be an important
> > emphasis when writing action files, in order to
> insure modularity.
> > Comments?  Suggestions?
> >
> > <cfcase value="adminFormSave">
> >     <cfinclude template="act_formSave.cfm">
> >     <cfinclude template="act_logAdminAction">
> >     <cflocation
> url="index.cfm?fuseaction=adminGoodJob">
> > </cfcase>
> >
> > <cfcase value"formSave">
> >     <cfinclude template="act_formSave.cfm">
> >     <cflocation url="index.cfm?fuseaction=goodJob">
> > </cfcase>
> >
> > Reid Hankins
> >
> >
> >
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to