Open Power Forms is a new OPL library focused on form processing. It uses the features of Open Power Template template engine to render the forms and is going to provide a rich set of widgets, validators and filters. Its objective design will allow you to process even the most complex forms.
Form processing is often an underestimated part of the web application. The programmers focus on the functionality or the modules and forget that the forms are the most important way to communicate with the user. He would like to see a smart form that informs him on the mistakes he have done, and tips where and what to correct. What is more, the websites developed nowadays often require to insert complex data, such as dates or colours. Simple input fields are not enough for the programmers. Finally, the form must be easy to style by the webmasters, as it simplifies the maintenance and reduces the costs. This is why we decided to write Open Power Forms.
The library is currently under heavy development with the basic functionality completed.
A typical form with a list of fields is just a single type of HTML forms. On some websites, the programmers would like to create multi-step forms or compose bigger forms of smaller ones. Open Power Forms is going to support such compound forms out-of-the-box. The form processing model we are implementing increases the code reusability and simplifies the refactoring process. It helps the programmers to design any form they want without any problems.
Powerful layout customizations
Rendering a form is one of the most complex tasks, as the form logic is heavily mixed with the HTML code that defines the layout. Many form processing libraries use pure PHP in this place. Simpler systems just leave this task to the programmer who must code all the logic of every single field manually in a template. The more complex ones provide various decorators and other PHP classes that deal with the element rendering. However, it has several disadvantages:
- It is unnatural. The programmer defines the layout of the most of the page, writing a normal HTML code, but here he is forced to use a special API and massive OOP just to change the HTML tag around the form field.
- It is easy to break the MVC model by moving a typical presentation task to the logic layer. Such layout is hard to maintain and unportable.
- Custom form structures require you to write your own decorators and/or do tricks in order to generate the HTML code you want to.
Open Power Forms chose a completely different way. It uses Open Power Template 2 template engine which provides several tools designed especially for forms which make desinging their layout much more natural. With components and snippets, the programmer creates a fully customized template and OPT gives it life. We can define a single look and use it in all the forms, or take over the control and give a field a specific design at any time we want to. OPT not only removes the limitations of PHP, but also does not introduce new ones.
Open Power Forms is currently at early stage of development. It processes the basic forms correctly and provides the most important features. We are preparing to release the first development versions, but you can always track the changes on Subversion repository.