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

Create delete button with server-side action


Go to End


1273 Views

Avatar
PeterR

Community Member, 15 Posts

24 January 2015 at 7:33am

Edited: 24/01/2015 7:34am

Hi all,

I would like to create list with my custom actions. I mean something like:

<form method="post" action="...">
   <li>Task 1 <input type="submit" data-value="1">Delete</input></li>
   <li>Task 2 <input type="submit" data-value="2">Delete</input></li>
   <li>Task 3 <input  type="submit" data-value="3">Delete</input></li>
   <li>Task 4 <input type="submit" data-value="4">Delete</input></li>
</form>

I want that delete method will be defined in controller as php function which will parse data-value of selected button and then delete record.
Could you please give me a hint how to do it in SilverStripe?
Or is there any better way how to delete items?

Btw, I want to have this list in front-end, not in CMS.