What is B-Forms?
B-Forms is an object-oriented PHP library that generates and processes submitted HTML forms. I started developing this library in 2000 to fill my own web-programming needs. It had undergone 2 major and one minor revisions, when I realized that it may be useful for other people and released it to public as version 1.0.
The current stable version is 1.2.
Despite its seeming simplicity, the library allows to create and handle very complex forms. This makes it suitable for development of web-based applications. Its main benefits are:
This library is easy to learn and start using. Defining a form is a very easy task, most of the form-handling work is done for you. What you have to concentrate on is the business domain: load data into the form data structure, validate and save the data after the user submits the form.
The library sets up a well-defined structure of your PHP scripts, clearly dividing the script into three logical areas: form definition, data management, and form presentation.
Forms have a powerful block architecture, each block typically representing a different data object within the form. What is more important, each block can be used to edit several objects at once - the record management will be done by the library. Weekly time-report form is a good example of using multi-row blocks.
The library automatically saves and restores hidden fields. All hidden fields are signed with an MD5 hash, which provides security against tempering for those hidden values.
Forms can optionally run in auto-detect-changes mode. Your validation and saving routines will only be executed if the end-user has actually changed some of the values.
The library provides two base layouts that allow to generate forms automatically in the vast majority of cases. Only in special cases of very tricky form layouts you would have to write HTML code to specify the form layout.
The library is designed to avoid unneeded class inheritance. You do not need to define a new form class for each form. You just instanciate the base class and tune the form's behaviour through the use of triggers (similar to event listeners or callback functions). However, unlike with the typical event listeners, you do not need to tell the form where to find them. Triggers are just PHP functions named according to certain rules. If you define such functions, the form will automatically use them.
You can find out more about the architecture of the library by looking at the design factors that have driven its development or by looking at the manual.