762 Posts in 312 Topics by 291 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 677 Views |
-
Form Widget doesn't work on Blog Pages

2 July 2011 at 2:57pm Last edited: 2 July 2011 2:57pm
I made some custom widgets. All is well except that my Form Widget doesn't work on Blog pages (it does work on all other pages).
Error:
popCurrent called on ModelAsController controller, but it wasn't at the top of the stack
POST /websitename/blog/widget/24/FormWidgetWidget Form Code
class FormWidget_Controller extends Widget_Controller {
function FormWidget() {
return new Form(
$this,
'FormWidget',
new FieldSet(
new EmailField('EmailFormWidget')
),
new FieldSet(
new FormAction('doFormWidget', 'Submit')
),
new RequiredFields('EmailFormWidget')
);
}function doFormWidget($data, $form) {
//Set data
$from = $data['EmailFormWidget'];
$to = 'example@example.com';
$subject = "this is the subject";
$body = '<h1>Email Signup List</h1><p><b>Email Address</b> - '.$data['EmailFormWidget'].'</p>';
$email = new Email($from, $to, $subject, $body);
$email->send();
Director::redirect(Director::get_current_page()->Link() . "?success=1");
}
// Allows us to show different content in template "if Success"
public function SuccessFormWidget() {
return isset($_REQUEST['success']) && $_REQUEST['success'] == "1";
}
}Thank you
-
Re: Form Widget doesn't work on Blog Pages

10 July 2012 at 8:46pm Last edited: 10 July 2012 8:46pm
I have the same issue. I know it is an old post, but did you find a solution for this?
Thanks in advance
Matze
| 677 Views | ||
|
Page:
1
|
Go to Top |


