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.

Customising the CMS /

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

Linking to Form from TableListField?


Go to End


1500 Views

Avatar
_Vince

Community Member, 165 Posts

18 September 2009 at 1:45am

Hi, I am having the following problem.

In a site that ships orders...

I have a table of orders.
each order has a customer,
each order has one or more order lines,
each order line has a product.

I would like to make some sort of CMS based way of letting the users close orders manually (for when the order doesn't get shipped or is picked up by the customer). I have an OrdersPage which extends Page and all the tables are links to each other with has_one.

All I want is to be able to display all the info the user needs to choose an order (customer, products purchased, date, etc) and then a popup where they can record why they are closing the order, the date, etc. It's all information that belongs in the order header. I am displaying data from various tables but only updating ONE table.

For display, it looks like the best option is to use a TableListField as per http://doc.silverstripe.org/doku.php?id=tablelistfield

The TableListField doesn't let me edit records but I can link to something where I can edit.

And that's my problem: the documentation provides an example of linking to the form for editing the members, but I'm having trouble with adapting that link to my situation. How do I create a popup to which I can link from the TableListField? Even a form on a tab would do.

at the moment I have

$tbl->setFieldFormatting(array(
'Edit' => '<a href=\"/ft4/admin/show/116?executeForm=EditForm&ID=1\">Go to</a>'
));

But all that happens is that it calls page#116 but no form is displayed. Is there any way of linking to a form or a popup? Or passing the data to a form on a tab?