I have updated Formed, my PHP HTML Form Generator, to provide support for errors. The functionality is there, but I have not updated the tutorial yet to cover error handling. Setting errors is actually as easy as calling the set_errors method of the Formed object and telling it what errors you want to set. Below is a simple example:
$myForm->set_errors (array ("Comment" => array ("You must provide a comment!", "The comment field must be at least 10 characters!"))) ;
This example shows setting 2 different error messages for the comments field element. That’s all there is to it. The DefaultTemplate and the black_and_white template were updated to incorporate the tags needed for processing errors. The others will be updated as time permits. You can make the edits yourself if needed sooner by following the example in black_and_white. I’m excited about this new feature and I have already used the functionality in my Your Brain site.
On a related note I always like to give a shout out where it is warranted. Although I have not used it, the PHPForms product looks pretty nice if you need to render static HTML forms. Although this is not the goal of Formed, I still think their form builder implementation is intuitive and well done. If you need to develop static forms you should give them a look. If you need to generate dynamic forms in your code then Formed may be more appropriate for your project.
My latest experiment is building a new site without leveraging one of the many MVC Frameworks that are out there today. I decided to approach a new project using the following criteria:
To be fair, my results were a mixed bag, but so far I’m happy with the experiment. The site is not open to the public yet, but you can check out the current version here if you are curious how it is going. Below is a brief out line of the tools I used and the results (good, bad and ugly)!Continue Reading
Please allow me to introduce Formed, a simple PHP based HTML form generator class. The primary objectives I had when creating Formed were:
I created a home site for it in the event that people wanted to try it, make suggestions (be nice), provide changes, that kind of thing. It is not on GitHub because it does not warrant that level of control at this point. The site is built on Joomla and the template is one of the defaults that I barely modified so it looks funny. If you go to the link above you can down load the zip file or read the tutorial. If you are interested check it out and post a comment here.
As a side note, PHP CMS tools must be in a tragic state these days. Joomla was easy enough to get working, but it is far from intuitive when you first use it. By contrast Drupal I could not even get working on Apache. To be fair I did not put much time into either one, but isn’t that the point of a CMS? It is a sorry state of affairs.