Thursday, August 5, 2010

How to turn a html form into a complex JavaScript object

Programmer Question

Is there a way to turn a form into a complex JavaScript object based some structured form?



Now, I have no idea if this should be done in a better way, but basically I want something like this:










and I want this in JavaScript:



var form = GetForm();
var obj = ConvertFormToComplexObject(form);

//
// Followings should be true
//
// obj.Foo == 1;
// obj.Parent != null
// obj.Parent.Child1 == 1;
// obj.Parent.Child2 == 2;
//


Any suggestions?



Thanks,



Find the answer here

No comments:

Post a Comment

LinkWithin

Related Posts with Thumbnails