Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Form Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Group fields for easy processing


Go to End


1581 Views

Avatar
JoshuaLewis

Community Member, 81 Posts

1 November 2009 at 5:21pm

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?