I am developing an application in Flex. There are 20+ 'pages', each with its own form. I need to collect all the entered data and pass it to an API method. What I am wondering is when I should begin to pass the data and what the best way to collect it might be. I was thinking of instantiating a class
public class myCollectorClass
The API method has 10 parameters, 4 of which are not determined by the forms. Of the 6 remaining parameters, 5 are simple strings with few options. Those are not the difficult part. It is the last parameter that is the most difficult to work with:
public var myDataSet:DataSet[]; //DataSet is a data type from the API
The forms fall into two categories: Geographical Data which controls the geographical area of the API return values. And Search Data which controls the type of data returned within the geographical parameters. For instance, if you are looking for an IT company in the US Zip code 93003.
As you can see, the geo and search parameters are arrays not simple strings and a typical collection will contain multiple zip coes, area codes SCBA codes etc., as well as hundreds of search parameters.
Would it be better for me to pass each selected value to the array each time a value is entered?
btnAddParameter.addEventListener(Event.CLICK, dataHandler)
Or pass all of the values at the end right before an order is placed?
for each dataContainer in myClass
{
var dataObj:Object;
dataContainer.value = dataObj;
myParamArray.addItem(dataObject)
}