I'm used to ASPNET and Django's methods of doing forms: nice object-orientated handlers, where you can specify regexes for validation and do everything in a very simple way.
After months living happily without it, I've had to come back to PHP for a project and noticed that everything I used to do with PHP forms (manual output, manual validation, extreme pain) was utter rubbish.
Is there a nice, simple and free class that does form generation and validation like it should be done?
Clonefish has the right idea, but it's way off on the price tag.
I have recently used the project listed above - http://code.google.com/p/php-form-builder-class/ - in development and noticed that the latest release (version 1.0.3) replaces the table markup with a more flexible div layout that can be easily styled to render forms however you'd like. There are many examples that can help you get started quickly.
I would recommend this project.
Here's another free alternative:
http://code.google.com/p/php-form-builder-class/
It lets you create a form with code like:
include("../class.form.php5");
$form = new form("form_elements");
$form->addHidden("cmd", "submit");
$form->addTextbox("Textbox:", "field0");
$form->addTextarea("Textarea:", "field1");
$form->render();
Pros:
Cons, which eventually kept me from using it:
It's looks to be under active development, so might be worth keeping an eye out for future versions/improvements.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With