cfinput or input

Posted on 2011-04-20
Medium Priority
Last Modified: 2012-05-11

I've always used <input> and was looking for some opinions on using cfinput or input.  With cfinput, it can validate within the tag, and with input I use javascript to validate my form.  I know cfinput writes it's own javascript behind the scenes, but again just looking for opinions on which method is better?  Doe it depend on what I am trying to validate?  Also, I'm aware I need to also validate on the server side in case the user disabled javascript.

Question by:nmarano

Accepted Solution

pdd1lan earned 500 total points
ID: 35437433
really depend what you like to use.

my opinion: since you develop in Coldfusion, might well to take advantage and benefit <cform><cfinput>:  clientside and serverside validation, available in HTML, Flash, XML, etc...

like you mention, you have to create javascript for valiadtion of the field when you are using <INPUT>, extra time and coding require.

LVL 11

Assisted Solution

by:Brijesh Chauhan
Brijesh Chauhan earned 500 total points
ID: 35438143
You can use CFINPUT along with CFFORM tags, CFINPUT has lot of inbuilt validations, and you can also validate JS functions using onVALIDATE function.

Other things which you can do is Tooltips and you can also BIND the CFINPUT for AJAX controls. Also there is a TYPE DATEFIELD which opens a calender for you to select date, pretty neat and easy

<cfinput name="stDate" type="datefield" label="date:" mask="mm/dd/yyyy"/>

Open in new window

Read the DOCS here http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7f51.html for examples..
LVL 52

Assisted Solution

_agx_ earned 500 total points
ID: 35438232
I agree with @pdd1lan.  It's not really a matter of "better". It depends.. on a) your needs b) what you're using now and c) your personal preference.

Cfinput supports most of your common form validations, plus a few other features.  So if you're using home grown validation, using cfinput would be a time saver.  On the other hand, if you have very complex validation needs OR if you're already making heavy use of other libraries (like jquery) you may want to stick with an external library, rather than splitting the focus.

Just my $0.02
LVL 16

Assisted Solution

by:Gurpreet Singh Randhawa
Gurpreet Singh Randhawa earned 500 total points
ID: 35439209
@ all!

CFFORMS are Good and Better, But if you do a Shared Host, the most cases, The Cfform tags are broken, because of it could find the CFIDE/Scripts/Cfform.js file in the webroot and validation fails! --

      So the workaround to this is upload your own cfide/scripts/cfform.js file and if you intend to use masking you have to use mask.js file which resides in the cfide/scripts folder. and yes it does decrease performance as if u use masking, it will take hell lot of time to interpret it and with cfform.js inside the webroot, so many inbuilt things which you might not need in your file.

Js has its own capabilities -- validate only what is required , use patterns, and anything you like, my Choice input forms rather than cfform tags

Author Closing Comment

ID: 35440018
Thank you all for your comments. Thanks for the different perspectives

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is an updated version of a post made on my blog over 3 years ago. It is unfortunately, still very relevant as we continue to see both SQLi (SQL injection) and XSS (cross site scripting) attacks hitting some of the most recognizable website and …
Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question