FusionScript is designed to allow you to use reasonably simple ColdFusion
tags (custom tags) to create client-side JavaScript code essentially using
the same syntax you use for the rest of your ColdFusion code. I haven't used
it personally because of it's use of custom tags and my still trying to
support CF 5. ( Without cfimport you have to have all your templates in the
same directory or you have to put the FusionScript templates in the custom
tags directory which usually isn't feasable if you have shared hosting. )
FusionScript does some other things (the ActiveServer component is really
impressive -- it's not actually a server, just a means of communicating with
the CF Server without refreshing a page), but as I understood it, that was
the original thrust of it.
If you're just looking to validate your data, you can of course, always use
server-side script on the action page. I frequently place the action-page
within the same template and have it post back to itself, perform validation
at the top with a try-catch statement then populate the form with form
variables.
<cfif isdefined("form.membername")>
<cftry>
<cfif not len(trim(form.membername))>
<cfthrow type="mycustomtype"
message="Please enter your name.">
</cfif>
<cfif not isemail(form.memberemail)>
<cfthrow type="mycustomtype"
message="Please enter a valid email address.">
</cfif>
...etc...
<cfquery ...>
INSERT INTO MEMBERS ...
</cfquery>
<cfcatch type="mycustomtype">
<div style="color:red;">
<cfoutput>#cfcatch.message#</cfoutput>
</div>
</cfcatch>
</cftry>
</cfif>
<form ...>
<cfparam name="form.membername" type="string" default="">
<input type="text" name="membername"
value="#htmleditformat(form.membername)#">
...etc...
</form>
You can also use CFForm for which there is plenty of documentation -- it
creates client-side javascript validation. I've avoided using it in general
because I've not been happy with the way it works. On CFMX it includes a
client side .js file which can be pointed to with a new scriptsrc attribute,
i.e. <cfform scriptsrc="/lib/cfform.js" ...> This is an improvement over the
previous versions as it allows you to customize the client-side script and
the behavior of the cfform tag without making any changes to the CF Server.
Then there's the default ColdFusion Server server-side validation:
<input type="text" name="membername" value="">
<input type="hidden" name="membername_required" value="Please enter your
name.">
This will halt processing of the next page and ask the user to use their
browser's back button, providing a list of error messages from fields not
properly provided. _required requires a field, _date requires the field to
be a date and _numeric requires the field to be a number. I think there may
be a couple others, but those are the ones I remember. It should still be in
the CF Server documentation.
And then there's the qForms API ( http://www.pengoworks.com ) which is a
JavaScript API for client-side form validation. I use it (usually in
combination with server-side validation using the try-catch as above). I've
been pretty impressed with the API in general, although it does show the
occasional bug, just like any other open-source project. I've had to fix the
_trim() function a couple times by overwriting the one provided in the API
with my own (infinite loop - ick).
One or more of these should get you where you need to be. :)
If you use client-side validation ( cfform, qForms or FusionScript ) I also
recommend that you use some form of server-side validation as well. The
default ColdFusion Server method of using hidden form fields with _required,
_date etc. is likely to be the easiest and as a result least prone to error.
hth
s. isaac dealey 954-776-0046
new epoch http://www.turnkey.to
lead architect, tapestry cms http://products.turnkey.to
tapestry api is opensource http://www.turnkey.to/tapi
certified advanced coldfusion 5 developer
http://www.macromedia.com/v1/handlers/index.cfm?ID=21816
> What do you mean? You mean, does it jack with the OS or
> files on the system?
> It does not. Check out the site, read the docs and you
> will get a good idea
> what it is and what it does.
> ----- Original Message -----
> From: "Murat Demirci" <[EMAIL PROTECTED]>
> To: "CF-Talk" <[EMAIL PROTECTED]>
> Sent: Sunday, February 23, 2003 9:34 AM
> Subject: RE: Form validation
>> Is it secure?
>>
>> -----Original Message-----
>> From: Bruce Sorge [mailto:[EMAIL PROTECTED]
>> Sent: Sunday, February 23, 2003 5:08 PM
>> To: CF-Talk
>> Subject: Re: Form validation
>>
>> There is something out there called FusionScript. It is
>> supposed to
>> allow
>> you to validate nearly every field type, and it is
>> ColdFusion based. You
>> can
>> download it at www.fusionscript.com. The current version
>> that is out
>> there
>> is free. The next version you may have to pay for, Nate
>> has not totally
>> decided yet. I just started playing around with it a few
>> weeks ago and
>> so
>> far it is very good.
>>
>>
>> ----- Original Message -----
>> From: "Murat Demirci" <[EMAIL PROTECTED]>
>> To: "CF-Talk" <[EMAIL PROTECTED]>
>> Sent: Sunday, February 23, 2003 8:28 AM
>> Subject: Form validation
>>
>>
>> > Hi folk,
>> >
>> >
>> >
>> > I need to validate all fields of a membership form in
>> > my huge CFMX
>> app.
>> > But I don't have enough information about the reliable
>> > way.
>> >
>> >
>> >
>> > I have searched the web but found no reliable and full
>> > (advanced
>> level)
>> > information.
>> >
>> >
>> >
>> > Is there a guide, a sample or an article to help me?
>> > What are your
>> > suggestions?
>> >
>> >
>> >
>> > Thanks in advance.
>> >
>> >
>> >
>> >
>> >
>>
>>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ~~~~~~~~~~~|
> 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
> Structure your ColdFusion code with Fusebox. Get the
> official book at http://www.fusionauthority.com/bkinfo.cfm
> Unsubscribe: http://www.houseoffusion.com/cf_lists/uns
> ubscribe.cfm?user=633.558.4
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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