This may be a VERY dumb question, but I'm brain fried.

Okay - so I'm working on a form and I need to validate fields for many
things.  Taking "email address" for example I need to validate that it's
been filled in (not zero length), that it's less than 255 characters (the
database limit), that it fits a email format and finally that the email
address isn't already in use.

What I'd like to be able to do is check through all these validations.  The
instant a problem is found I want to stop checking.  I would then redisplay
the form and so forth.

In a custom tag or function I might, when an error is found simply "return"
to the caller with the error information.  Since this is a rather small set
and is only the first of many small forms I decided (perhaps wrongly) to
just do the validation at the top of the page.

To simulate a components ability to return at any point I wrapped the whole
validation block in a CFLOOP from 1 to 1 (1 iteration) - as soon as I hit an
error (and set the error variable) I CFBREAK.  Right after the loop I check
the value of the error variable.

Now that I'm looking at it I'm not sure... is this just the stupidest thing
you're ever heard?  Should I take the extra time and create a customized
validation custom tag for each and every form?

Jim Davis

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. 
http://www.fusionauthority.com/ads.cfm

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to