EasyCFM.COM ColdFusion Forums / Work Showcase! / CFValidator!

   Reply to Discussion | New Discussion << previous || next >> 
Posted By Discussion Topic: CFValidator! -- page: 1 2

book mark this topic Printer-friendly Version  send this discussion to a friend  new posts last

JJfutbol
08-06-2005 @ 11:54 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Moderator
Posts: 1250
Joined: Nov 2004

CFValidator 1.2 in the works!!!
Wow already? You bet it is son! I've changed the RE code for the following functions: isSSN, isSafeString, isUsername and isPassword. I have also added in 3 new functions: isFileName, isAlphaNumeric, and isCreditCardCode. Due to credit cards having many different lengths and numbers I will be completely redoing the isCreditCard function so that it has unique RE for VISA, MasterCard, American Express, Diner's Club and Discover. For those of you that work alot with forms where a user is paying via credit card, this validator is definitely for you. Smile  Because v1.1 is out I won't release this one for a little bit. I want to get some suggestions from all of you!! Help me out here so I can make CFValidator better for everyone.


EDIT -Announcing CFValidator 1.1!!!
If you jump down to the bottom of this topic you should see my new post about CFValidator 1.1 and the new additions or changes that have been made. I will be adding a list of functions for all to see.


Old Message - First post
My latest project is complete! This is definitely my best work to date and I think it will help everyone here. I'm a big CF fan but I have had to learn other web languages recently due to new jobs. Within the past few months I've learned ASP and have gotten ok with it so far. I've realized as I learn other languages there's only 2 things I absolutely need to know. How to create self-posting validating forms and queries. After that I can usually figure out everything for myself.

I've always have wanted to really get into using CFCs, Functions, and just code reuse in general especially with my forms. I figured with the form validation I was doing across the board making my Validator.cfc would save me a ton of time and it has. I'm sure if you guys use my Validator.cfc you will cut the amount of time in half that it takes you to make a complete form with working validation. I've tried to include every possible function in my Validator.cfc and hope you guys will provide me with many more.

So far it works very easily. All you got to do is on the page where form posts too (whether its the same page or not) you create the Validator object and call the Init function and pass it a value of "Sentence" or "Comma". Those 2 values define the format of the error message that is returned once validation is complete. So here is an example:

<cfscript>
Variables.Validator = createObject("component","validator").Init("List");
</cfscript>

Easy no? Then after that it only gets even easier. You just call all the functions you need, pass them their required arguments which mainly are just 2: the form variable and the custom error message. For example this is what you would have:

<cfscript>
Variables.Validator = createObject("component","validator").Init("List");

Validator.isEmpty(Form.FullName, "Please enter your name.");
Validator.isEmail(Form.Email, "Please enter a valid email.");
Validator.isPhone(Form.Phone, "Please enter a valid phone number.");
Validator.isZip(Form.Zip, "Please enter a valid zipcode.");
Validator.isCreditCard(Form.CreditCardNum, "Please enter a valid credit card number.");
Validator.isSSN(Form.SSN, "Please enter a valid SSN.");

//Get Validation Result
Variables.ErrorMessage = Validator.getResult();
</cfscript>

Then at the very end, you should see in the above cfscript statement I call the getResult() function which pretty much just returns one long string that contains the error message. If I set the format in the Init function to sentence, each sentence above would appear on a new line. If it was set to comma it would be in a comma delimited list. I recommed using the comma delimited list if you do not have many fields and just want to output the name of each field required as in my Contact form for example: http://www.javier-julio.com/contact/

Then within your form you simply display the error message with any formatting you deem necessary and you are all set. Fast, easy and simple, no? Smile  I hope you all like my latest work and feel free to download it and edit it as you wish. All I ask is that you share that with me so the rest of the community can benefit from it. Test out the form here:

http://www.javier-julio.com/Test/Validator/index.cfm

And you can download it on the following page:

http://www.javier-julio.com/coldfusion/downloads/

Enjoy! And let me know of any functions you would like to see included in the Validator.cfc or any suggestions on how to make it more useful and portable. Hope you all enjoy my latest work.

----------------------------------------------------
Need FREE CF applications?? Then my site has it all, http://www.javier-julio.com/coldfusion/downloads/ In time I will be including many more free CF apps as you will see many listed up top on that page.

This message was edited by JJfutbol on 8-17-05 @ 12:00 AM

neilmerton
08-10-2005 @ 5:43 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Senior Member
Posts: 166
Joined: Mar 2004

200+ views and not one reply? shame on everyone!

great looking site you've got going Javier. I'll definately be spending some time going through and trying out your code etc!

thanks for sharing Smile

____________________________________
I need to read more!

JJfutbol
08-10-2005 @ 6:20 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Moderator
Posts: 1250
Joined: Nov 2004

Yes I know its sooo depressing. Frown  I really felt this was my best work to date. I thought everyone would love it and see that it really saves developers time. I've always wanted to make my form validation code reusable and in the long run I'm sure that using my validator development time will be cut in half when you are creating a form.

Thanks for the kind words about my site. Smile  I went full CSS, web standards, and accessibility. I'm loving every minute of it as I've jumped ship. I always was a table/images guy even though I sucked at images. My new layout for my site, or rather layouts as I have a Fall and Winter theme, is what I truly aimed for so I'm glad how it turned out. I've actually gotten some job offers out of it as well.

As always its great to share. I love sharing and helping out others. I don't like to give away code unless its truly helpful and I feel this is. My contact form I give out as well because my most valuable skill is self posting forms. I use that ALL the time. Please download the validator and use it. I promise you will love it. Smile  It saves me so much time as I never have to see my CFC because I know the functions, they are easy to learn and remember. I will have a new version soon with a date and passwordconfirm function as well as the option to output error messages in a unordered list. Enjoy! Smile

----------------------------------------------------
Need FREE CF applications?? Then my site has it all, http://www.mygamingnation.com/coldfusion/downloads/ In time I will be including many more free CF apps as you will see many listed up top on that page.

JJfutbol
08-10-2005 @ 6:21 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Moderator
Posts: 1250
Joined: Nov 2004

neilmerton, you are officially the mackdaddy in this forum for being the first post. Well done. Smile

----------------------------------------------------
Need FREE CF applications?? Then my site has it all, http://www.mygamingnation.com/coldfusion/downloads/ In time I will be including many more free CF apps as you will see many listed up top on that page.

JJfutbol
08-15-2005 @ 9:41 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Moderator
Posts: 1250
Joined: Nov 2004

Has anyone tried out my CF Validator?? I think it will save you all a great deal of time. Please share any info with me about how I can make it better and more useful. Thanks.

----------------------------------------------------
Need FREE CF applications?? Then my site has it all, http://www.javier-julio.com/coldfusion/downloads/ In time I will be including many more free CF apps and ASP ones as well. Currently working on a fully accessible Forum, which validates as full CSS and XHTML 1.1.

Webmaster
08-15-2005 @ 3:42 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Administrator
Posts: 4542
Joined: Jan 2002

No replies because all those people were busy downloading the application and incorporating it into their existings apps Smile

Looks like a winner... I will play with it further and see about getting it incorporated into the re-development of EasyCFM.COM Smile


Pablo Varando
Chief Software Architect
EasyCFM.COM, LLC.

904.483.1457\\ mobile
webmaster@easycfm.com\\email

JJfutbol
08-15-2005 @ 4:26 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Moderator
Posts: 1250
Joined: Nov 2004

Awesome! You sincerely would consider implementing it Pablo?? Definitely let me know if you do! Especially anyways to make it better. I need to know if people prefer other ways to display error messages. In my next version I plan to make the form accessible, styled via CSS and add in a IsValidDate function along with a PasswordConfirm function. I'm hoping people are downloading it as I'm getting lots of people to visit everyday. I just never get any input from anyone! Frown  It kills me. I want to make the cf apps I got better and with more features but no comments or suggests anytihng. I'm gonna add some new stuff to my Login next I think with redirects and maybe a registration page even though that technically should be somewhat seperate.

----------------------------------------------------
Need FREE CF applications?? Then my site has it all, http://www.javier-julio.com/coldfusion/downloads/ In time I will be including many more free CF apps and ASP ones as well. Currently working on a fully accessible Forum, which validates as full CSS and XHTML 1.1.

JJfutbol
08-16-2005 @ 1:34 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Moderator
Posts: 1250
Joined: Nov 2004

CFValidator 1.1 is now available!!!

I have made just a few changes and some new additions which I think you will all very much like. With the release of CFValidator 1.1 I had changed/updated the following:

  • Added isPasswordConfirmed function that compares two password strings.
  • Added isDateValid function that checks to make sure the string is a valid date.
  • Renamed isTime function to isTimeValid.
  • Added isXSS function for extra precautions when it comes to malicious code that could possibly be entered in a form. XSS stands for Cross Site Scripting. If XSS code is found it REMOVES all html tags so when the form is redisplayed with that variable there are no problems or errors.


Feel free to try out the isXSS functionality on my test validator page at the following link:

http://www.javier-julio.com/test/forums/

----------------------------------------------------
Need FREE CF applications?? Then my site has it all, http://www.javier-julio.com/coldfusion/downloads/ In time I will be including many more free CF apps and ASP ones as well. Currently working on a fully accessible Forum, which validates as full CSS and XHTML 1.1.

This message was edited by JJfutbol on 8-16-05 @ 1:34 AM

megan
08-16-2005 @ 9:48 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Moderator
Posts: 2398
Joined: Jan 2003

Thanks! JJ Smile  It's really nice of you to share your hard work with the rest of us ~ regards, megan

We have art so that we shall not die of reality ~ Nietzsche

JJfutbol
08-16-2005 @ 9:55 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Moderator
Posts: 1250
Joined: Nov 2004

Hey its np at all! Its what I do best! Being myself. Smile  Sharing is a good thing. I realize that when I go online I don't expect to pay anything for code or applications so I have no right to ask that of you guys. But as I get more apps up I will put up a donation box. I have just been to lazy to set it up. Thanks for the kind words. Smile  Hope you are all using the Validator! Please let me know how I can make it better because I want to release newer versions!!

----------------------------------------------------
Need FREE CF applications?? Then my site has it all, http://www.javier-julio.com/coldfusion/downloads/ In time I will be including many more free CF apps and ASP ones as well. Currently working on a fully accessible Forum, which validates as full CSS and XHTML 1.1.

PAGE: 1 2

Website Designed and Developed by Pablo Varando.