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.

Customising the CMS

FormAction on CMS tab


Reply

990 Views

Avatar
brettski

21 June 2009 at 8:38pm Community Member, 1 Post

Hi all,

I'm new to silverstripe, so please be gentle :)

I'd like to add a FormAction button, or something similar, to a tab within the CMS. I've attached a screenshot of what I'd like...the functionality is obviously the part I'm having trouble with. I've got the code for sending emails and pulling subscribers from the database, but I can't figure out how to get the button to call the function I've defined for doing so.

This code...

$fields->addFieldToTab('Root.Content.Newsletter', new FormAction('SendEmail', 'Send Email to Newsletter Subscribers'));

...causes this error

Fatal error: Call to undefined method SubscritionEmail::sendemail() in C:\xampp\htdocs\raes\sapphire\forms\Form.php on line 803

My SendEmail function is defined in the same file as the $fields->addFieldToTab, etc is written.

Is it possible to get the FormAction to call a function within the same page it is defined. ie, not calling back to Form.php?

Thanks for your help

Attached Files