I've set up a few different Silverstripe sites, but for the first time now I am using the DataObject as a Page pattern. I've read through the information on different ways to do this and I've run into a problem:
I've got a DataObject representing staff members and Page operating as a holding page. The page has allowed_actions for listing, searching and showing staff members, and on the show pages there is a form that allows to to send an email to a staff member.
Since the ContactFormHandler method is on the StaffHolder page controller, when it is called, it has no access to the staff object (which is normally picked up on the 'show' action) so it can't determine where to send the email.
There are a few ways I can think of to fix this:
1. Send extra url parameters to the form with the staff member ID, but I can't find anywhere in the API to achieve this.
2. There is a pushCurrent() method on Controller, which might allow me to push a new ShowStaffMember_Controller onto the controller stack and then have the FormHandler on this new controller. Not sure if this is possible though, but would love to hear if anyone has been able to do this?
3. Pass the ID through a session variable - Not ideal, but probably which way I will try first.
4. Pass the ID through a hidden field - Really don't want to do this as the email shouldn't be exposed in the form.
Wondering if anyone else has run into something like this and how they solved it?