XForms cometh to PHP ! Throw out HTML_Quickform?
PHP Architect has an article in their June 2006 issue about using XForms within PHP5. If you don’t know what XForms is/are, you’d better look into it. It’s basically a way to describe forms on your page and all the data validation rules entirely in XML. The form presentation and validation capabilities of it are kind of like HTML_Quickform on crack.
Of course, there’s always a rub. No browsers natively support XForms. The article in PHPArch uses the FormFaces JavaScript to get things to work. But I don’t like the way FormFaces comes off. They tout both a GPL license and a commercial one but then they mask the JavaScript so you can’t extend it or see how it’s actually working. That smells like a temporary GPL license to me.
So, I don’t think you could do XForms on the client side just yet. It’d be nice if someone would step up and create a server-based solution for XForms in PHP. Maybe I’ll do that myself. In the meantime though, the Quickform folks are already busy planning HTML_Quickform2, a PHP5 version of their form production code. That will have to do for now I suppose.
Share this via del.icio.us, digg, email, etc.
Trackback for "XForms cometh to PHP ! Throw out HTML_Quickform?"
5 Responses to “XForms cometh to PHP ! Throw out HTML_Quickform?”
By Erik Bruchez (XForms Everywhere) on Jul 25, 2006 | Reply
If you don’t like the FormFaces license, look at the Orbeon PresentationServer (OPS) engine! Its open source license allows you to build commercial and non-commercial applications with no strings attached. OPS could certainly be hooked up to PHP as well. See:
http://www.orbeon.com/software/get-excited
for demos. Note that a lot has changed since the last stable release (3.0.1) and that the next stable release, scheduled for August, promises many new features, performance enhancements, and ease of use. You may also be interested in this talk we did at XTech on XForms and Ajax:
http://xtech06.usefulinc.com/schedule/detail/133
By Rich Zygler on Jul 25, 2006 | Reply
I’d taken a look at this recently. I’d reallly like either an all PHP solution or an all JavaScript solution on the client side instead of Java. The work you folks are doing does look interesting though.
By Erik Bruchez (XForms Everywhere) on Aug 2, 2006 | Reply
Thanks Rich. Just a few precisions: with OPS, there is minimal JavaScript running on the client (although “minimal” can become pretty large as you add widgets like trees, etc.), and the Java code runs exclusively on the server.
Based on our experience implementing XForms, I have to say that I have doubts about the practicity and limitations of an all-JavaScript implementation due to the sheer amount of code required to implement XForms completely and all the JavaScript pitfalls in browsers, including memory leaks. (I have noticed for example that FormFaces takes a very long time just to load.)
In fact back in early 2005 we wondered whether we should go all JavaScript or bet on a distributed implementation using Ajax for our new XForms engine in OPS. We chose the latter and have not regretted this decision one bitl. Even though the JavaScript code we have is minimal, it is still hard to write and maintain.
This said I have respect for people trying to implement XForms purely in JavaScript. That’s a quite daunting task!
By Gary Sikora on Mar 13, 2007 | Reply
All
It was never FormFaces intent to mask JavaScript so it cannot be extended - many users have extended the libraries. FormFaces is now under a BSD license, free for commercial and non-commercial use. In addition, there is a CLA for those contributing to the code base.
While a JavaScript implementation sounds difficult, it is, but it was possible, including handling various browser anomalies. In addition, while the resulting code size seems to be large due to the difficulty of the task, it is just 80KB. Finally, this 80KB library can be cached.
We intend to flush out the FAQ site at http://www.FormFaces.com to address these issues surrounding FormFaces that periodically resurfaces.
Cheers!
By John Kugelman on Mar 13, 2007 | Reply
Late reply… Too bad we didn’t see this article when it was written last year.
The formfaces.js file end users download is compressed to save space. Many JavaScript libraries do this to ease download size. A properly-setup webserver would serve formfaces.js using gzip compression, but we can’t rely on that. For our purposes, we use Dean Edward’s JavaScript packer (see http://dean.edwards.name/packer/).
The full, uncompressed source is included in download package we provide on SourceForge. It’s far from masked! Our source is heavily documented with Javadoc-style comments.
Anyways, to answer the other concern, we worked hard to improve performance with the latest release. We worked on both load time and UI responsiveness.