PDA

View Full Version : creating one form from multiple forms by combining JSONs



optibase
26 Apr 2011, 5:18 AM
Hi All :) Hope everyone is well!

I have a page with 6 different forms submitted by Ajax on one submit click (going to different PHP URLs).
Sometimes though I am requested to submit only one form that contains only the changed fields in all 6 forms as one single submit to a different URL (PHP).

What I want do is read all the dirty fields is each form and use a dummy form that will hold all dirty values from all 6 forms. somethinsg like this:
var form1DirtyParamsObject = form1.getForm().getFieldValues(true);
var form2DirtyParamsObject = form2.getForm().getFieldValues(true);
.. etc

then I want to concatinate all the returnes objects and use them as the one object that goes in to the submit(CombinedObject).

My question is regurding the concatination of the objects returnrd from
getForm().getFieldValues(true); calls.
Any suggestions on how to best achieve that?
how do I get one object that holds the values from multiple object?

Of coursea, whole together better approach is welcome :)
Thanks a lot

friend
27 Apr 2011, 10:21 AM
As an alternative approach, a Form can have other nested child panels in its 'items' collection, so you could basically have one container form for what looks like six different forms.

You could then do the dirty work based on one getValues() call to the form.