Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / Getting Started / November 2006



Tip: Looking for answers? Try searching our database.

Form Validation

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
sean69 - 30 Nov 2006 01:00 GMT
I'm trying to write a CFC to help with validation on some forms....  

How can I use the <cfargument> tag to specify that the "form" scope structure
is required?
(i.e. I want to pass all the form name,value pairs in one arguement)

<cfinvoke component="#Application.CFCPath#.ValidateFormObj"
method="ValidateForm" argumentcollection="#form#" >

<cffunction name="ValidateForm" returntype="array" output="true">
    <cfargument name="SomeData" required="yes" type="struct">
Dan Bracuk - 30 Nov 2006 03:41 GMT
You are off to a good start with the argumentscollection=form.  Not sure why
you want to return an array.  

In fact, given that cfc's are a type of reusable code, and that not all forms
are the same, I'm not sure why you are even bothering with the extra complexity
of using cfc's.
sean69 - 30 Nov 2006 15:50 GMT
What I am trying to do is build a form validation cfc that I can just hand a
form to and have it hand me back an array valid or invalid field names.

currently I'm doing something like:
<input name="UserName" type="text" class="AdminField" id="UserName"
value="#UserName#" size="15" maxlength="15" />
<input name="_UserName" type="hidden"
value="String,min=8,max=12,NoProfane,NoMatchPasswd" />

I'm hoping to be able to do something MORE like: (though I'm not sure how to
this will be possible)
<input name="UserName" type="text" class="AdminField" id="UserName"
value="#UserName#" size="15" maxlength="15"
value="String,min=8,max=12,NoProfane,NoMatchPasswd" />

As you can see I want to be able to perform several different types of
validation on one name/data pair with as little extra code as possible....

Wouldn't it be nice to be able to html just the form - nothing else no cfif,
no extra hidden fields... hand it off to a cfc and have it come back valid or
invalid??

So anyway....  back to my question.

How do I specify in the cfargument that the required dataype IS the form
structure/collection?

Any thoughts?

-sean
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.