You could use the Object Controller and bind field by field and use a nested
object like yours as model. Have you tried using an object controller for
that?
I use the object controller for all my forms and think it pretty flexible.
The only think that I'm not sure that will work in your scenario is
when serializing your model into json. I don't know if it serializes nested
models. But if that a problem you can easily create your own function to do
that.
On Thu, Nov 18, 2010 at 7:35 AM, sub <[email protected]> wrote:
>
> Hi all,
>
> I was interested to hear about people's approaches to managing form data
> that is nested/hierarchical.
> The screenshot attached is my (cut down) example where I have groups of
> fields arranged in one form. There are also common elements or field groups
> that can be reused in certain parts of the form. My aim was to build these
> from re-usable classes (see the address field group used in two locations).
>
> As part of my requirements I need to send the serialized json data to the
> server as a nested object graph.
> The example json (related to the screenshot) is below.
>
> Given the hierarchical nature I can't really use the form controller as is.
> I could use a separate controller for each form group but that would be
> messy. Alternatively I could add the elements in a flat nature using dot
> notation. EG "job.main.address.line1" and then serialize it into json.
>
> I'm sure people have had to come up with techniques to bind nested object
> graphs - anyone care to share? I've gone down this path a few times but I
> feel I'm making something much more complicated than needed.
>
> {
> job : {
> "jobStatus": {
> "id": 1,
> "name": "Prepare Fee Proposal",
> "version": 0
> },
> "jobType": {
> "id": 3,
> "name": "Child Care",
> "version": 0
> },
> "startDate": new Date(1230814800000),
> "completionDate": null,
> "useClientAddress": false,
> "version": 0
> "address": {
> "id": 90,
> "line_1": "L3",
> "line_2": "6ce",
> "line_3": "emptyne",
> "postcode": "2000",
> "state": "NSW",
> "suburb": "Sydney",
> "version": 0
> },
> "client": {
> "address": {
> "id": 87,
> "line_1": "Cl 3",
> "line_2": "6lient",
> "line_3": "empty line",
> "postcode": "2000",
> "state": "NSW",
> "suburb": "Sydney",
> "version": 0
> },
> "contactDetails": {
> "email": "j...@com",
> "faxNumber": "9900877",
> "homeNumber": "99987754",
> "id": 151,
> "mobileNumber": "04222222",
> "name": "Client John Doe",
> "version": 0,
> "website": "http://www.google.com.au/",
> "workNumber": "56433699"
> },
> "id": 1,
> "version": 0
> },
> }
> }
> http://qooxdoo.678.n2.nabble.com/file/n5750949/Screenshot.png
> --
> View this message in context:
> http://qooxdoo.678.n2.nabble.com/Form-data-managing-complex-nested-form-data-tp5750949p5750949.html
> Sent from the qooxdoo mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> Beautiful is writing same markup. Internet Explorer 9 supports
> standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
> Spend less time writing and rewriting code and more time creating great
> experiences on the web. Be a part of the beta today
> http://p.sf.net/sfu/msIE9-sfdev2dev
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
Spend less time writing and rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel