Bs_Form is a package that implements HTML forms as PHP classes.
With all its features and the 46 classes (18'000 lines of documented code)
it is by far the most comprehensive web form building and handling we have seen.
If you read on, you'll see why. And what it can do for you.
Features (in general):
- Multistep forms (like a wizard).
- Optional templates (for the form AND for containers).
- Multilingual (field captions, default values, error messages).
- Very, very strong on serverside input validation.
- Access rights; the same form can be used for different users/groups.
- Can deal with hitting enter in text fields (submit form, jump to next field like tab, ignore).
- Offers some nice domapi form element implementations (see domapi.org)
- and some more ready-to-use out-of-the-box special fields.
- Can deal with include-once and onLoad javascript stuff. (Some elements need js files and page "onLoad" code in the header of the document.)
- Auto-persisting of submitted forms to database. This includes the auto-creation/update of the database table.
- Auto-emailing of submitted form data.
- Strong file-upload handling.
- No limits: everything you can do with plain HTML can be done with this package.
|
|
Is it good for me?
+ |
Lots of built in features ready to use |
+ |
Saves development time and boring re-coding of the same form-handling over and over again |
- |
Quite some CPU usage, don't use it for big forms that get hit too much without knowing what
you are doing. At least not without content caching. Anyway, use a php accelerator.
|
- |
you need to dive into the examples, classes and/or documentation a bit
to learn about all it can do.
|
Examples
|
Class structure of the form elements:
(This does not include the classes Bs_Form, Bs_FormBuilder, Bs_FormTemplateParser, Bs_FormHandler and Bs_FormIniHandler.)
How it works: (tested in Internet Explorer 5+, Mozilla 1+, Opera 7+)
MouseOver/Out the boxes to display/hide information about the class.
Click to fix/hide the information layer.
Form features:
- specify name, action, target, encryption type. if the form uses a file field (for uploading), the enctype is automatically set to "multipart/form-data".
- styles and "advanced styles"
- useAccessKeys; if set to true, access keys will be used for the fields even if the field has no special setting for it. then the first letter will be used.
- onEnter; prevent a form from auto-submitting when a user hits enter in a form field.
- must fields; fields the user may not omit should be displayed a bit different. some default behavior for this can be used.
- templates; the form and container elements can use templates for absolutely customized visualizations of your forms. if not used then the forms use default visualization and still look good.
- automatic sending of emails with raw data
- viewCount and usedTime; how many times did the user submit the form until all inputs were accepted? this information is collected for you.
- jumpToFirstError; when the user submitted the form with errors, the program can set the focus to the first form field where an error occured.
Form element features: (fields etc)
- caption; the text displayed next to the field.
- default error messages (input validation) for different types of user errors, defined in language files. custom error messages can be set.
- level; if it's a "multistep" form then one can specify to what step this field or element belongs.
- editability; depending on the form mode we're in, fields can be set to read-only, hidden etc.
- visibility; the default visibility of a form field can be overwritten.
- accessRights; who can do and see what.
- default value; the default value can be different based on the language that is in use. also there are field types (multiple select fields) that can have multiple default values.
- dynamic default value; a default value does not need to be hard-coded, it can be made up of other field values or from evaluated php code at runtime.
- internally there is a valueReceived, valueInternal, valueDisplay and valueDefault.
- saveToDb; when the form gets submitted it can be automatically persisted into a database table. each field can be defined to be included or not.
- styles; various style definitions based on HTML/web standards. class, css style, id, title, label, right-to-left etc.
- events; all javascript events like onChange, onBlur, onMouseOver etc can be used.
- onEnter; some browsers immediatly submit a form if one hits enter in any field, even if the field has not been filled in completely. this can be annoying especially for newbies. with blueshoes one can overwrite the default behavior of the browser, and have it jump to the next field (just like tab) or ignore the enter key.
- data type; about 25 data types to choose from. this helps for the input validation. examples: text, email, year
- data type info; additional information for the data type. example: if the datatype is text, we can limit the characters to a-zA-Z0-9.
- ignore error; all input validation rules can be set to 'may overlook'. if for example we want at least 10 characters of input in a field, but only receive 7, the program warns the user. then - if this option is set - he can check a checkbox to ignore this error.
- must; a field can be set to "must be filled in".
- must if; a field can be set to "must if" this and that. example: email address must be filled in if the user wants our newsletter (newsletter checkbox is on). highly configurable.
- must one of; this field or another one of the specifield fields must be filled in. example: we want a phone number OR an email address of the user filling in the form.
- must one of if; combination of must if and must one of if. example: we want the private or business email address if the user wants our newsletter.
- only one of; only one of the fields specified (including this one) may be filled in.
- only if; field may only be filled in if condition is true. example: only type in a delivery address if user specified that it's different than the billing address.
- min length
- max length
- must start with; the input must start with the string specified. example: an url must start with "http"
- not start with; may not start with the string specified.
- must end with
- not end with
- must contain
- not contain
- equal to; this fields input must be equal to another fields input. example: the input of the password field must be the same as the one of the password-again field.
- not equal to; example: the user name may not be equal to the password.
- must be unique; if the value must be unique in a db table field. example: we don't want 2 users with the same username.
- regular expression: one or more regular expression the user input has to pass to be accepted.
- additional check; all the given checks may not be enough for you. then you can use custom php code to validate the user input.
- trim; the user input can be trimmed o the left, on the right or on both sides.
- remove; for example the string "http://" can be removed from the user input. can be done case-sensitive aswell.
- replace; for example the string "www" can be replaced with the string "ftp". can be done case-sensitive aswell.
- case; the user input can be converted to uppercase, lowercase, uppercase words etc.
- code post receive; some php code can be executed after receiving the user input. this allows custom modifications on the value.
|
|
See also
License:
Available with
- BlueShoes "developer basic" license
- BlueShoes commercial licenses
Check the license overview page for details.
|
|