I'm building a form that will give authorized users the ability to submit orders for products. It is populated from a dataobjectset and for each object shows a product code and name as literal fields with paired hidden fields to pass the data and fields for selecting a quantity and product size. Once submitted the selections are processed into an email with the users info and sent off. The rest of the transaction is handled outside of the website.
A copy of my current code can be found here (I'm using the multiform module): http://pastie.org/677713
At the bottom that page you can see an example of how data is output from the form.
What I would like to find is a way of grouping the fields so that they are easier to work with by product rather than one long array.
The best solution I have so far is to write a method that will iterate through the submitted form data and rebuild it as multi-dimensional array like this example. http://pastie.org/678572
Any thoughts?