Formcat:Form Validation Generator

Auto-generate the javascript
for client-side validation
based on Smarty.
It’s easy and flexible
[Formcat on SourceForge]
[Formcat on HotScripts]
[Formcat on PHPCLASSES.ORG]

News:

BIG NEWS: FORMCAT 1.04 RELEASED. see online demo

[2005-06-11]Formcat 1.04 released. Click here to download Formcat 1.04 Pro Version
*Add “optional” attribute to all validator except “dateCompare”.
*Fix a bug : When there are no form tags in template,formcat will return blank page.
*Fix a bug: When there are no catform tags in template,formcat will return blank page.
Formcat’s changelog)

You can also download Formcat 1.04 Lite Version Here
[Formcat 1.04 Documentations Are Available Now] [Simplified Chinese Version Doc]

click the button to donate:



Support This Project

Formcat is a class for performing form validation on the client side.Its goal is to generate Javascript code to validate forms before they are submited to the server.

It works as a plug-in for the Smarty template engine. It is a good complement SmartyValidate plug-in that performs server side validation.It supports many built-in validation criteria: empty, range, length,checkbox, radio button, integer, float, email, credit card, list menu,date, date comparison, equality between fields, file size, file type, custom validator calls.

{formcat …} tags can be located anywhere in the templates, regardless of where the corresponding fields are located in the form.

Formcat 1.04 released. Click here to download Formcat 1.04 Pro Version

Older Versions:

[Download Formcat 1.03 here] [Download SmartyValidate 2.3 here]

[Download Formcat 1.02 here]

[Download Formcat 1.01 here]

If you like the Formcat,don’t forget to donate.Your donation allows me keep the Formcat up-to-date,fun,cute,and easy to use.Thanks.

Features:

* Multi-forms in a page can be supported.
* Supplied validation criteria to provide empty,range,length,checkbox,radio button,integer,float, email,credit card,list menu,date,date comparison,equality between fields,file size,file type…and customzied validator calls.Auto-genenrate the Javascript for client-side validation by “formcat tags” .

* {catform…} extra function attributes can make your validation colorfully and easily.
* {formcat …} tags can be located anywhere in your template, regardless of where the corresponding fields are located.It’s very flexible.It’s very good soultion for validation combining the Smarty-Validate.

* Multiple validators may be used for one field.And User can add other validating javascript function into the function which auto-generated.

* Easy to expand the validator.just copy the custom validator to the validator directory

Requirements:

You must enable session management prior to using Formcat . Do this by calling session_start() at the top of your PHP application.Formcat also requires the Smarty template environment. [Download the Smarty template environment here]

Installation:

To install Formcat:

* Copy the ‘formcat.class.php’ file and “validators” directory(lite version don’t need to do that)to a place within your php_include path (or use absolute pathnames when including.)

* Copy all of the plugins to your Smarty plugin directory. (located in the plugins/ directory of the distribution.)

Background:

Form validation is one of the most frequently performed tasks when it comes to web application programming.In order to decrease the run load of server,we usually validate the data in client-side by Javascript or other script,but it’s a tedious and time-consuming task.

SmartyValidate is powerful class to provide form validation in server-side.I didn’t find a good solution for client-side validation.I heard that there’s a class could solve both. It’s Formsess.However,Formsess has following problems:

1.more bugs and no one supports.I found a few obvious bugs.

2.the manual seems a litte bit simple.According to it,you can’t get result as it said.

3.the fatal problem is that Formsess makes basic html tags change to the “fs tags” Unfortunately there are not HTML editors can detect them.It’s not user-friendly.

(Please forgive me for my personal opinion to Formsess.:-) )

Therefore, I developed the “Formcat” to solve them.It’s a part of my development framework which named “PIGCAT development framework”(not released yet).Formcat just performs the client-side validating.You basically provide the validation criteria and error messages,Formcat does the rest.

Special Thanks:

Messju Mohr (from Smarty forum)
Monte Ohrt (from Smarty forum)
boots (from Smarty forum)
Sylvestre Ledru (contributed “flashFocus” extra function,http://sylvestre.ledru.info/)

Formcat changelog

Changelog:

[2005-6-10]
*Add “optional” attribute to all validator except “dateCompare”. (Thanks for Vego’s comment)

[2005-06-09]
*Fix a bug : When there are no form tags in template,formcat will return blank page.
*Fix a bug: When there are no catform tags in template,formcat will return blank page.

[2005-02-24]
*Fix a bug which the “foreach” error was appeared when page has no formcat tags.
*Fix a bug from addCustomJs.

[2005-02-17]
*Fixed some big bugs.such as extra functions are generated repeatedly.
*Update the extra attribute processing mechanism.easy to extend.
*Found a bug in Netscape.The flashFocus can’t run if <form ..>html tag without “id” attribute.(it’s not a bug from Formcat,just from compatibility of browsers)

[2005-02-14]
*add the catform extra attributes : flashFocus and submitOnce.
*update the old version.released 1.02 version.

[2005-02-13]
*fix a bug from “radioChecked” to get correct result,when the form just contain one radio button.

[2005-02-02]
*fix a bug from “isEmail” validator to match “.biz”,”.info”,”.name” domains in email address.
(joey,thanks for Sylvestre Ledru http://sylvestre.ledru.info/ )

[2005-01-05]
* fix a bug from formcat.class.php and block.catform.php,put the genenrated scripts
above the <form> instead of <head>. (joey,thanks for Ganesh).
* cancel case-sensitivity in attributes of formcat tags.(joey)

[2005-01-04]
* fix some bugs from validators.(joey)
* modify the validator “isFileSize”. (joey)

[2005-01-01]
* add the block tags “catform”. make it can process multi-forms.(joey)
* delveoped the version to make the expansion easily from “Lite version” (joey)

Formcat’s FAQ

FAQ:

Q: Could I remove {catform} tag when there’s only a form in page?

A: No. Each form must be registered by {catform} tag before it can be validated.

Q: I’ve used Formcat,but I can’t see the validate javascript in page source?

A: You must check that the {catform} and {formcat check=”"} are exist.And the page should be have <form> html tag. Formcat just can detect three format of <form> tag. They are <form>,<Form>,<FORM>.If your form tag is <FoRm>.the formcat can’t detect it.

Q: Formcat can support multi-form in one page?

A: Yes.Each form must be registered by {catform} tag before it can be validated.please check the sample

Q: Could I use Formcat without Smarty?

A: No.Formcat is running as Smarty plug-ins. It can only run with Smarty.

Q: Formcat can validate on server-side?

A: No.Formcat just to perform client-side validate javascript generating.

Q: What differents from Formcat lite and Formcat pro?

A: Pro version and Lite version has the same function and features.Only different is : lite version has few file,it’s compact but inefficient.Pro version separated all validators and put them into validators folder.it’s easy to extend.


Q: Why I can’t see the FlashFocus in Netscape? However it can run in IE and Opera.

A: At first it’s not a bug from Formcat,just from compatibility of browsers.I ‘ve found that how to solve it.It can’t run in Netscape if the <form ..> tags has no “id” attribute. Just add “id” attribute into your html <form..> tag.f

Formcat Documentation

Formcat Reference Guide

View Online:

1.04 Version : English ,   Simplified Chinese


1.02 – 1.03 Version : English , Simplified Chinese , Traditional Chinsese

1.01 Version: English, Simplified Chinese

FatCloud by Netlife

World Quote

“Always tell the truth. Then you don't have to remember anything.”
by Mark Twain Roughin' it

Sponsors

Propagator’s Products

Formcat
SlideCrab
ImgOwl