HOME   SITEMAP   CONTACT   NEWS   BLOG
Search


Framework PHP Forms Package


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.


Bs_FormElement

The mother of all form elements.
Documentation for this class: PHPDoc

Bs_FormImage

Implements the <image> tag.
Documentation for this class: PHPDoc

Bs_FormLine

Implements the <hr> tag.
Screenshot:

Documentation for this class: PHPDoc

Bs_FormText

Allows the coder to put plain text into the form (between form fields).
Documentation for this class: PHPDoc

Bs_FormContainer

Implements a bag to put in other form elements. Such containers can be encapsulated.
A container can have its own template. If there is none, its elements will be spitted out based on default formatting.

Screenshot:

Note: the border can be invisible so a user does not see at all that there is a container.

Documentation for this class: PHPDoc

Bs_FormField

The mother of all form fields.
Documentation for this class: PHPDoc

Bs_FormHtml

Allows the coder to put HTML into the form (between form fields).
Documentation for this class: PHPDoc

Bs_FormCode

Allows the coder to put PHP code anywere that will be executed.
Documentation for this class: PHPDoc

Bs_DaFormPageControl

Implementation of the domapi page control so it can be used with forms.
Screenshot:

Documentation for this class: PHPDoc

Bs_FormFieldTxt

Mother of all text fields.
Documentation for this class: PHPDoc

Bs_FormFieldImage

Implementation of the standard image field (which can be used as alternative to a submit button).
Documentation for this class: PHPDoc

Bs_FormFieldHidden

Implementation of the hidden form field <input type="hidden">.
Do you need a screenshot for this? :-)
Documentation for this class: PHPDoc

Bs_FormFieldTextarea

Implementation of the textarea form field <textarea>.
Screenshot:

Documentation for this class: PHPDoc

Bs_FormFieldCheckbox

Implementation of the standard checkbox html field.
Screenshot:

Documentation for this class: PHPDoc

Bs_FormFieldBtn

The mother of all button fields.
Documentation for this class: PHPDoc

Bs_FormFieldRadio

Implementation of the radio form field <input type="radio">.
Screenshot:

Documentation for this class: PHPDoc

Bs_FormFieldSelect

Implementation of the select form field <select>.
Screenshot:

Documentation for this class: PHPDoc

Bs_FormFieldFile

Implementation of the file-upload field.
Screenshot:

Documentation for this class: PHPDoc

Bs_FormFieldPassword

Implementation of the password field.
Screenshot:

Documentation for this class: PHPDoc

Bs_FormFieldText

Implementation of the text field.
Screenshot:

Documentation for this class: PHPDoc

Bs_FormFieldButton

Implementation of the button form field <button>.
Screenshot:

Documentation for this class: PHPDoc

Bs_FormFieldSubmit

Implementation of the submit form field <input type="submit">.
Screenshot:

Documentation for this class: PHPDoc

Bs_FormFieldReset

Implementation of the reset form field <input type="reset">.
Screenshot:

Documentation for this class: PHPDoc

Bs_FormFieldSex

Special field, used for gender only. Can use the onomastics package to validate the input.
This field works together with the Bs_FormFieldFirstname and Bs_FormFieldLastname.
Screenshot:

Documentation for this class: PHPDoc

Bs_FormFieldSelectImage

Special field. Like a radio button, but custom images can be used.

Documentation for this class: PHPDoc

Bs_FormFieldChVisa

Special field.

Documentation for this class: PHPDoc

Bs_FormCountryList

Special field. Select fields with all countries. One of the languages english, german or french can be used. Screenshot:


Documentation for this class: PHPDoc

Bs_DaFormFieldComboBox

Implementation of the domapi combo box widget so it can be used in forms.
Screenshot:

Documentation for this class: PHPDoc

Bs_DaFormFieldListBox

Implementation of the domapi list box widget so it can be used in forms.
Screenshot:

Documentation for this class: PHPDoc

Bs_FormFieldEmail

Special field, used for email addresses only. Can use the email validator class to validate user input on 3 levels (syntax, host, account).
Screenshot:

Documentation for this class: PHPDoc

Bs_FormFieldFirstname

Special field, used for given names only. Can use the onomastics package to validate the name.
This field works together with the Bs_FormFieldLastname and Bs_FormFieldSex.
Screenshot:

Documentation for this class: PHPDoc

Bs_FormFieldLastname

Special field, used for family names only. Can use the onomastics package to validate the name.
This field works together with the Bs_FormFieldFirstname and Bs_FormFieldSex.
Screenshot:

Documentation for this class: PHPDoc

Bs_FormFieldDatePicker

Special field, used to make it easy to type in (select) dates.
Much faster than the domapi implementation (it really depends if you use 3 in the same form), and works with pre-1970 dates. But maybe not as nice.
Screenshot:

Documentation for this class: PHPDoc

Bs_FormFieldWysiwyg

Special field. Direct integration of the wysiwyg editor into Bs_Form so it can be used without extra coding.

Screenshot:

Documentation for this class: PHPDoc

Bs_FormFieldSpreadsheet

Special field. Direct integration of the spreadsheet editor into Bs_Form so it can be used without extra coding.

Screenshot:

Documentation for this class: PHPDoc

Bs_FormFieldSlider

Special field. Direct integration of the slider widget into Bs_Form so it can be used without extra coding.

Screenshot:

Documentation for this class: PHPDoc

Bs_FormFieldTree

Special field. Direct integration of the tree widget into Bs_Form so it can be used without extra coding.

Screenshot:

Documentation for this class: PHPDoc

Bs_DaFormFieldColorPicker2

Special field; implementation of the domapi color picker 2 widget.
Screenshot:

Documentation for this class: PHPDoc

Bs_DaFormFieldDatePicker

Special field; implementation of the domapi date picker widget.
Screenshot:

Documentation for this class: PHPDoc

Bs_DaFormFieldSpinEdit

Special field; implementation of the domapi spin edit widget.
Screenshot:

Documentation for this class: PHPDoc