plainblack.com
Username Password
search
Bookmark and Share

    

WG8 Form Builder API

User preaction
Date 10/30/2009 8:06 pm
Views 994
Rating -1    Rate [
|
]
Previous · Next
User Message
preaction

In WebGUI 8 we are deprecating the old WebGUI::Form, WebGUI::HTMLForm, and WebGUI::TabForm. It's time for a more modern approach: WebGUI::FormBuilder.

I've created a preliminary implementation in the "formbuilder" branch of the WebGUI repository.

The skinny:

WebGUI::FormBuilder builds an entire form. Forms are made up WebGUI::FormBuilder::Tabs, WebGUI::FormBuilder::Fieldsets, and Fields (our old WebGUI::Form::Control with some minor additions).

The FormBuilder object will be able to export itself to good old HTML, or to a set of template variables for Template Toolkit, or even to a hash reference for serialization (of course, JSON serialization is just a single toJson() away). The idea here is that the (Data)Form asset is just a configured instance of a FormBuilder object.

Tabs and Fieldsets can also have Fields, Tabs, and Fieldsets inside of them. Deep recursion is possible, if you want tabs inside of fieldsets inside of fieldsets inside of tabs inside of fieldsets, FormBuilder will not stop you (but I may whack you upside the head). The adding of different objects to Forms, Tabs, and Fieldsets are implemented as Roles, so that new Form object can be implemented quickly (dialogs perhaps?).

Tabs, Fieldsets, and even whole Forms can also be added to other Forms, so you can combine two Forms on-the-fly and then display the result to the user. Name conflicts are, of course, completely up to the programmer to resolve (since they're impossible to predict), but FormBuilder will have mechanisms to make it easy.

Finally, FormBuilder forms will parse the form's results and give them to you as a hashref. No more messing about with the four different arguments to WebGUI::FormValidator (though the option will remain, of course).

This is a very preliminary implementation. I've also attached the specification document I've been working on/from.

Questions, comments, arguments, or feature requests are welcome. 



Attached Files
Back to Top
Rate [
|
]
 
 
cap10morgan
On Fri, Oct 30, 2009 at 6:06 PM,   wrote:
> preaction wrote:
>
> In WebGUI 8 we are deprecating the old WebGUI::Form, WebGUI::HTMLForm, and
> WebGUI::TabForm. It's time for a more modern approach: WebGUI::FormBuilder.
>
> I've created a preliminary implementation in the "formbuilder" branch of the
> WebGUI repository.
>
> The skinny:
>
> WebGUI::FormBuilder builds an entire form. Forms are made up
> WebGUI::FormBuilder::Tabs, WebGUI::FormBuilder::Fieldsets, and Fields (our
> old WebGUI::Form::Control with some minor additions).
>
> The FormBuilder object will be able to export itself to good old HTML, or to
> a set of template variables for Template Toolkit, or even to a hash
> reference for serialization (of course, JSON serialization is just a single
> toJson() away). The idea here is that the (Data)Form asset is just a
> configured instance of a FormBuilder object.
>
> Tabs and Fieldsets can also have Fields, Tabs, and Fieldsets inside of them.
> Deep recursion is possible, if you want tabs inside of fieldsets inside of
> fieldsets inside of tabs inside of fieldsets, FormBuilder will not stop you
> (but I may whack you upside the head). The adding of different objects to
> Forms, Tabs, and Fieldsets are implemented as Roles, so that new Form object
> can be implemented quickly (dialogs perhaps?).
>
> Tabs, Fieldsets, and even whole Forms can also be added to other Forms, so
> you can combine two Forms on-the-fly and then display the result to the
> user. Name conflicts are, of course, completely up to the programmer to
> resolve (since they're impossible to predict), but FormBuilder will have
> mechanisms to make it easy.
>
> Finally, FormBuilder forms will parse the form's results and give them to
> you as a hashref. No more messing about with the four different arguments to
> WebGUI::FormValidator (though the option will remain, of course).
>
> This is a very preliminary implementation. I've also attached the
> specification document I've been working on/from.
>
> Questions, comments, arguments, or feature requests are welcome.
>
> http://www.webgui.org/forums/dev/wg8-form-builder-api
>
>
> --
>
> WebGUI
> http://www.webgui.org
>
>

Sorry for the late reply, I was on vacation for awhile.

One thing I'd love to see (and ended up implementing in my own fork of
DataForm) is a class to represent the individual form submissions. I
called my implementation DataFormEntry and it allows it me to quickly
access the values posted for each field for a given DataForm. I added
a getEntries method that returns an array of DataFormEntry objects.
Then I implemented an AUTOLOAD method to allow accessing the field
values as accessors on those objects. This is very handy when writing
workflow activities to process form submissions for automated delivery
of e-mails, importing into external systems, etc.

Wes

--
"Small acts of humanity amid the chaos of inhumanity provide hope. But
small acts are insufficient."

- Paul Rusesabagina, Rwandan and former hotel manager whose actions
inspired the movie Hotel Rwanda


Back to Top
Rate [
|
]
 
 
perlDreamer
WebGUI has had that since 7.6.1. It's in
AssetCollateral/DataForm/Entry.pm  It holds the set of data that the
user submitted, as well as the other metadata, like user, ip address,
date submitted, and so on.


Back to Top
Rate [
|
]
 
 
cap10morgan
Ah ha! That's what I get for (stupidly) forking DataForm in 7.3 then.
Thanks for the info. :)

Wes

On Mon, Nov 23, 2009 at 5:00 PM,   wrote:
> perlDreamer wrote:
>
> WebGUI has had that since 7.6.1. It's in
> AssetCollateral/DataForm/Entry.pm  It holds the set of data that the
> user submitted, as well as the other metadata, like user, ip address,
> date submitted, and so on.
>
>
> http://www.webgui.org/forums/dev/wg8-form-builder-api/2
>
>
> --
>
> WebGUI
> http://www.webgui.org
>
>



--
"Small acts of humanity amid the chaos of inhumanity provide hope. But
small acts are insufficient."

- Paul Rusesabagina, Rwandan and former hotel manager whose actions
inspired the movie Hotel Rwanda


Back to Top
Rate [
|
]
 
 
    



© 2012 Plain Black Corporation | All Rights Reserved