i have a form class which contains a private array of all fields. the
array has two columns:
one with a name-identifier and one that points to the actual field widget.
the form class has a method addField which adds a field of the desired
type (textfield, togglebutton, etc.). It takes as input: the field
type, the label text in front of the field and the field/parameter
name.

    generalForm = new myapp.component.compositeForm("A general Form");
    generalForm.addField("typeText","Your First Text","firstText");
    generalForm.addField("typeText","Your Second Text","secondText");
    generalForm.addField("typeList","Menu Style","menuStyle");
    generalForm.addField("typeBool","I like French Fries","likesFries");

The values of the form fields can be set using:
      generalForm.setFieldVal("firstText", "Dirty Harry");

and read using:
      generalForm.getFieldVal("firstText");

For the actual fields I created classes which take care of creating a
field with a label in front of it and some other stuff. This way I
added dozens of forms to my application with about a  line of code per
field.

On Wed, Jan 7, 2009 at 2:52 PM, Roman Schmid <mail...@banal.ch> wrote:
> Hello Developers
>
> I'm trying to build an Application that's composed of quite a lot of
> different forms (user-input forms). Since I'm new to qooxdoo, i was
> wondering how this could be done as efficient as possible. How do you
> guys/gals create forms in qooxdoo? Do you generate them dynamically, or
> build them "by hand"?
>
> What's the best way to retrieve/set form values? I was thinking about
> connecting them to properties; say i have a form-widget called "login"
> where there are two fields "Username" and "Password". I would then have
> 2 properties with that name, that are connected to the input fields.
> Setting a property would populate the input-field, getting would
> obviously get the input-fields value. That should be doable using
> data-bindings. Right?
>
> Or do you simply set the input fields as public properties of the form
> and then read/write them? That wouldn't be good OOP Practice, wouldn't it?
>
> Well, I'm kinda stuck here since there are some many feasible ways to
> this. If you lot could share some of your insight on that topic i would
> be grateful :)
>
> Cheers - Roman
>
> ------------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It is the best place to buy or sell services for
> just about anything Open Source.
> http://p.sf.net/sfu/Xq1LFB
> _______________________________________________
> qooxdoo-devel mailing list
> qooxdoo-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>

------------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It is the best place to buy or sell services for
just about anything Open Source.
http://p.sf.net/sfu/Xq1LFB
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to