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.

Data Model Questions /

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

2.4.5 - Forms assigned to DataObject?


Go to End


834 Views

Avatar
flipsidenz

Community Member, 49 Posts

2 September 2012 at 10:58pm

Is it possible to have a Form attached to a DataObject?

I have a ProductPage extending page, which loops through a DataObject called Product.

Each product displayed has a simple form associated with it - kind of like "send me quote" form. I hide each form with CSS and when a product's button is clicked, the form displays and is filled out by the user.

I want the form to be unique to the DataObject so that it can send a reference back in an email to the admin, telling them to provide a quote for that specific product.

If I set up one generic form through ProductPage, how would I know which product the user has selected to be quoted on?

There is no relationship between ProductPage and Product, other than within ProductPage a function is called which returns all Product objects.

I'd be interested to know how others would tackle this issue?