PHP Classes

Advanced PHP forms scaffolding AJAX enabled plug-in released - PHP Forms Class with HTML Generator and JavaScript Validation package blog

Recommend this page to a friend!
  All package blogs All package blogs   PHP Forms Class with HTML Generator and JavaScript Validation PHP Forms Class with HTML Generator and JavaScript Validation   Blog PHP Forms Class with HTML Generator and JavaScript Validation package blog   RSS 1.0 feed RSS 2.0 feed   Blog Advanced PHP forms sc...  
  Post a comment Post a comment   See comments See comments (2)   Trackbacks (0)  

Author:

Viewers: 18

Last month viewers: 7

Package: PHP Forms Class with HTML Generator and JavaScript Validation

Categories: New features

A new plug-in for the PHP forms generation and validation class to implement scaffolding forms with AJAX support and other advanced features was released.

This article presents the current and future features of the plug-in.




Loaded Article
Contents

* Introduction
* Live example
* Current features
* Future features
* Your feature wish list


* Introduction

As mentioned in the previous article, a new plug-in was developed to quickly build scaffolding forms.

phpclasses.org/blog/package/1/post/ ...

Like it was explained in that article, scaffolds are structures that help constructing buildings.

In the software development context, scaffolding libraries are used to create user interfaces for managing records of information, making it easy to perform basic CRUD operations on the records: Create, Read, Update and Delete.


* Live example

The package comes with an example script named test_scaffolding_input.php that demonstrates practically all features.

phpclasses.org/browse/file/26664.ht ...

If you would like to see it working live without installing it first, you may go to this page:

meta-language.net/forms-examples.ht ...


* Current features

- Basic CRUD operations and more

This plug-in can generate user interfaces for creating, listing, updating and deleting records of information.

Additionally, it can implement other operations like viewing individual records in detail, showing previews of the records being created or updated, and save records and continue editing them.

These operations can be disable or enabled individually. For instance, if you do not want to allow users to delete records, you can disable the delete function.

- Storage independent record manipulation

Often scaffolding components are meant to manage records of information stored in relational databases.

This plug-in does not implement the actual code that accesses the information records. So it can be used in applications that manipulate information stored in any type of containers, like CSV files, XML files, LDAP records, or even in cloud computing remote services like Amazon SimpleDB, Microsoft Windows Azure, etc..

The package comes with an example model storage class script named blog_post_model.php. It simply stores and retrieves records of blog posts in a PHP session array variable.

phpclasses.org/browse/file/26666.ht ...

You may want to study this class to learn how to create model classes that can store and retrieve information records from databases or wherever your application has stored its information.

- Customizable messages and view templates

The presentation of all types of forms and records listings can be changed by setting properties to replace the default templates.

The messages that are displayed during different scaffold operations are also configurable.

The package comes with an example view class script named blog_post_view.php that provides definitions of several types of presentation details.

phpclasses.org/browse/file/26665.ht ...

You may want to study this class to learn how to customize the presentation of your application scaffold forms.

- Automatic record listing with pagination

The listings of records can be totally configured. The application just needs to pass a bidimensional array with information that will appear in the rows and columns of the listing.

The plug-in displays a table on which each row represents a record. Each column represents the values of a given property of the records.

Additional columns may be presented with links to perform actions on each record. By default the additional columns present links to update or delete the respective records.

The listing may be split over multiple pages with a limited number of records per page . A navigation bar is displayed to let the user browse different pages of the listings.

The rows of the listing may be presented with a different color, alternating between odd and even rows. A special color may be used to highlight the row under the mouse pointer.

All the presentation details may be configured by specifying CSS classes or specific colors and CSS style definitions.

- Transparent AJAX support

Several types of interactions are AJAX enabled. This means that it is generated the necessary HTML and Javascript to interact with the server, so the user interface is updated without reloading the page.

This plug-in was designed in such way that applications handle AJAX requests like regular requests. So, applications do not need to have special code to handle AJAX requests, nor need to be aware when a request was made via AJAX.

If for some reason Javascript is disabled in the browser, it will gracefully fallback to non-AJAX interaction, as if AJAX support was not available.

- Record views and previews

This plug-in provides an optional feature that allows applications to determine whether the users can view a representation of the record without actually editing it.

When this feature is enabled, an additional link is presented in each listing row to let the user view a detailed presentation of the respective record.

Another optional feature is the ability to see previews of the records that are being created or edited without saving them.

The applications have complete control of the way a record is presented when it is being viewed individually or previewed while it is being created or updated.

- Save and continue editing

Another optional feature allows the users to save a record and continue editing it.

This is useful when the user needs to edit an information record of something that takes a while to be produced, like for instance, a blog post.

This way, the user can save his work regularly, so he does not loose it because his computer power failed, or the connection with the server was interrupted.

* Future features

For a first release, this plug-in already provides a substantial set of features. Still, there are some other features that were left out for now, but will be implemented in future releases.

- Custom main template

The presentation of the form and listings is configurable by changing several types of templates. However, the main template that defines where each user interface element appears is currently not changeable by setting a property.

This is an intentional limitation. The reason for the limitation is that I do not know yet how the developers may want to change it. Maybe they need to change it in such way that requires rethinking the way the template is defined.

I would not like to break backwards compatibility. Therefore, I disabled the property for changing the main template for now.

If you would like to layout the user interface elements in a way different from the default, just let me know what you have in mind, so I can make it possible to change it in a flexible way for everybody.

- Extend AJAX support to all interactions

Currently, only the interactions for showing previews or save and continue editing are AJAX enabled.

Future releases will enable AJAX support for other types of user interactions.

- Feedback animations

When the user performs an action that requires interaction with the server that may take a while, he needs to wait, but without any feedback he will be lost without knowing what is going on.

Another problem occurs when an action results in multiple feedback report messages. That is the case when the user saves a record and continues editing while a preview of the record is being displayed. The save result message is overwritten by the preview update message so quickly that the user does not see it.

A better user interface could provide such feedback using animation of page elements during interactions with the server or other operations that take a long time. Animations may also be used to display consecutive feedback messages that replace each other using smooth transitions.

- Custom operations

For now, only the built-in operations are supported. There is no easy way for applications to implement custom operations on individual records.

It would be nice if applications could specify custom operations that could be performed within the user interface to make it useful for other purposes besides those that were anticipated.

- Record listing sorting

Currently there is no way to let the user specify by which columns he would like to see the listing sorted.

It would be useful to have additional buttons or links in the headers of the listing columns, so the user can specify one or more columns that define the sorting fields, sorting priority and whether sorting should happen in ascending or descending order.

- Auto save records being edited

Some users forget to save their work once in a while. In some cases it would be better to have a way to automatically save the changes periodically or after significant changes are made to the records being edited.

- Secure submit buttons

Currently, regular submit buttons are used to trigger several types of actions.

For actions that may change data like create, update and delete, it would be better to use secure submit buttons to prevent CSRF attacks (Cross-Site Request Forgery).

- Spreadsheet like in place editing

Some users prefer to edit records directly in the listing, as if they were editing a spreadsheet. In place editing would make this possible.

* Your feature wish list

The list of planned features is already long. Unless there is a great demand for a specific feature, the features that will be implemented next will be determined by the needs of the projects I am working on.

So, if you have a great need for a specific feature, please let me know now.

Also, if you would like to see implemented any features that were not listed above, please let me know too by posting a comment to this article, so I can think better my priorities.



You need to be a registered user or login to post a comment

1,611,040 PHP developers registered to the PHP Classes site.
Be One of Us!

Login Immediately with your account on:



Comments:

1. Thanks and small correction - Preasionado (2009-04-10 03:27)
Going to try this soon.... - 1 reply
Read the whole comment and replies



  Post a comment Post a comment   See comments See comments (2)   Trackbacks (0)  
  All package blogs All package blogs   PHP Forms Class with HTML Generator and JavaScript Validation PHP Forms Class with HTML Generator and JavaScript Validation   Blog PHP Forms Class with HTML Generator and JavaScript Validation package blog   RSS 1.0 feed RSS 2.0 feed   Blog Advanced PHP forms sc...