Object Orientated Forms
Moderator: General Moderators
- Ollie Saunders
- DevNet Master
- Posts: 3179
- Joined: Tue May 24, 2005 6:01 pm
- Location: UK
Object Orientated Forms
I can't believe searches for this have come up with nothing.
Basically I'm looking for a PHP 5 (none of that PHP 4 smurf) OO form generator/validator etc.
Anyone know of a good one?
Basically I'm looking for a PHP 5 (none of that PHP 4 smurf) OO form generator/validator etc.
Anyone know of a good one?
- Ollie Saunders
- DevNet Master
- Posts: 3179
- Joined: Tue May 24, 2005 6:01 pm
- Location: UK
No don't. I started and then I realised that it is a pretty big undertaking.i may have to start writing one
There's QuickForms which is PHP4 and there's QuickForms 2 which is PHP 5 but in development with no releases at all. Then there's patForms which is PHP 4. All of them are pretty big.
Last edited by Ollie Saunders on Sat Aug 05, 2006 5:24 pm, edited 1 time in total.
- Ollie Saunders
- DevNet Master
- Posts: 3179
- Joined: Tue May 24, 2005 6:01 pm
- Location: UK
what these?feyd wrote:look on php classes..
- Ollie Saunders
- DevNet Master
- Posts: 3179
- Joined: Tue May 24, 2005 6:01 pm
- Location: UK
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
What type/style of OO form generator/validator are you looking for? Perhaps we could code one here in this thread.
The problem with them in not the manager itself, but all the supporting code needed to do everything required. Lots of style and personal preference issues to overcome to get more than one programmer to agree on all that stuff. Believe me ... I know.
You can look at the ones in the Skeleton code base. The Form Controller there is build on top of an general purpose Application Controller class which is in turn build on top of a general purpose Input Controller class, plus Filter and Validator classes, and a FormField generator class, and some containers. That's sort of the way building a "OO form generator/validator" goes ...
The problem with them in not the manager itself, but all the supporting code needed to do everything required. Lots of style and personal preference issues to overcome to get more than one programmer to agree on all that stuff. Believe me ... I know.
You can look at the ones in the Skeleton code base. The Form Controller there is build on top of an general purpose Application Controller class which is in turn build on top of a general purpose Input Controller class, plus Filter and Validator classes, and a FormField generator class, and some containers. That's sort of the way building a "OO form generator/validator" goes ...
(#10850)
- Ollie Saunders
- DevNet Master
- Posts: 3179
- Joined: Tue May 24, 2005 6:01 pm
- Location: UK
Like I said, pretty complex.The Form Controller there is build on top of an general purpose Application Controller class which is in turn build on top of a general purpose Input Controller class, plus Filter and Validator classes, and a FormField generator class, and some containers. That's sort of the way building a "OO form generator/validator" goes ...
Looks like I'm going to have to write it myself.
Its a nice idea but I won't be able to contribute because I'm up against a deadline here. So I'm just coding what I need write now. Once I've written it I'll post it here and you can all debate over it and extend it if you like.Perhaps we could code one here in this thread.
My requirements are many:What type/style of OO form generator/validator are you looking for?
- Valid XHTML output to HTML 4.01 spec
- Accompaning modular (many files not all required always) JS library and guidance CSS
- Doesn't attempt to replace logic, form logic is too varied and complex to ever successfully abstract, for instance validation rules of a whole groups of field may depend on the several validation tests of another, I couldn't image an OO interface capable of handling that better than procedurally.
For instance in the form below I have checkboxes in the fieldset that expand and collapse them. There is PHP logic that only checks the fields contained within it when its expanded. But of course things can get much more complicated than that. - Compatible with, or even better, intergrates with the ZF
- Adheres to the Zend Coding Standards (a very nice set of rules to code by)
- Support fieldsets, collapsible fieldsets, help sections, textarea, selects, buttons, checkboxes, radiobuttons etc.

The title (this is a pet peeve) should have been object oriented. Object Orientated would mean something very different.
Other nitpicks:
"None of that PHP4 smurf" to me translates to "I dont mind reinventing the wheel to avoid minor changes to a proven library, because of absolute standards". Might wanna rethink that.
Other nitpicks:
HTML 4.01 spec is for HTML. Not XHTML. XHTML would not be valid HTML 4.01.ole wrote:Valid XHTML output to HTML 4.01 spec
You do realize that the difference in a PHP5, E_ALL version of the php4 code could be as small as a dozen lines of changes, instead of coding your own?ole wrote:'m looking for a PHP 5 (none of that PHP 4 smurf) OO form generator/validator etc.
"None of that PHP4 smurf" to me translates to "I dont mind reinventing the wheel to avoid minor changes to a proven library, because of absolute standards". Might wanna rethink that.
- Ollie Saunders
- DevNet Master
- Posts: 3179
- Joined: Tue May 24, 2005 6:01 pm
- Location: UK
Wow, why has nobody ever corrected me on that before?The title (this is a pet peeve) should have been object oriented. Object Orientated would mean something very different.
You can write XHTML well-formed syntax but not follow the HTML 4.01 spec. So that's what I meant.HTML 4.01 spec is for HTML. Not XHTML. XHTML would not be valid HTML 4.01.
OK, again, I meant something different from what I said.You do realize that the difference in a PHP5, E_ALL version of the php4 code could be as small as a dozen lines of changes, instead of coding your own?
Generally people who write PHP 4 code write very procedurally; a lot of assoicative arrays. That's what I want to get away from. Instead I want a nice class hierarchy that is polymorphic and makes good use of PHP 5's data hiding capabilities as well as things like magic methods and exceptions.
What I'm trying to say really is that it need to be OOP through and through.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
I'd be interested to know what libraries you are interested in. Something like Prototype? Yahoo? Google?ole wrote:My requirements are many:
- Valid XHTML output to HTML 4.01 spec
- Accompaning modular (many files not all required always) JS library and guidance CSS
This can all be handled by a Rule based From Controller, but not everyone is comfortable with that style. I like it but I think I am in the minority in that.ole wrote:[*]Doesn't attempt to replace logic, form logic is too varied and complex to ever successfully abstract, for instance validation rules of a whole groups of field may depend on the several validation tests of another, I couldn't image an OO interface capable of handling that better than procedurally.
For instance in the form below I have checkboxes in the fieldset that expand and collapse them. There is PHP logic that only checks the fields contained within it when its expanded. But of course things can get much more complicated than that.
Everything I do these days follows those conventions so you can use loadClass(), etc.ole wrote:[*]Compatible with, or even better, intergrates with the ZF
[*]Adheres to the Zend Coding Standards (a very nice set of rules to code by)
I do a lot of this already on the server side. But some of this stuff is client side code.ole wrote:[*]Support fieldsets, collapsible fieldsets, help sections, textarea, selects, buttons, checkboxes, radiobuttons etc.
I am interested in creating a nice client side system to do pre-validation, effects, etc. If we can agree on the javascript library I think we could create something worthwhile. Even better would be to create a scaffolding generator that would generate matching server/client base code for the form.
(#10850)
I wrote my own form framework. It's awesome .. it does every form element imaginable (including stuff like map input using Google Maps, image upload with a variety of thumbnail options like clipping, checkbox trees.. loads). It's not object-oriented though, and it's PHP4. And it's not publically available. I'd definitely recommend writing one.. lots of fun.