cfinput or input

Posted on 2011-04-20
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
    LVL 8

    Accepted Solution

    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
    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 for examples..
    LVL 51

    Assisted Solution

    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 15

    Assisted Solution

    @ 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
    LVL 2

    Author Closing Comment

    Thank you all for your comments. Thanks for the different perspectives

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    This article  is about submitting  form through  ColdFusion.Ajax.submitForm to the action page and send a response back in JSON format which later can be decoded using ColdFusion.JSON.decode. By this way you can avoid the usual page refresh for subm…
    I spent nearly three days trying to figure out how incorporate OAuth in Coldfusion for the Eventful API. Hopefully, this article will allow Coldfusion Programmers to buzz through the API when they need to. Basically, what this script does is authori…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    779 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

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now