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

FormAction on CMS tab


Go to End


1681 Views

Avatar
brettski

Community Member, 1 Post

21 June 2009 at 8:38pm

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