• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 437
  • Last Modified:

cfinput or input


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.

4 Solutions
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.

Brijesh ChauhanStaff IT EngineerCommented:
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..
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
Gurpreet Singh RandhawaWeb DeveloperCommented:
@ 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
nmaranoAuthor Commented:
Thank you all for your comments. Thanks for the different perspectives
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now