我有一个名为ForgotPasswordPage.php的自定义页面和一个ForgotPasswordPage.ss模板.我还在ForgotPasswordForm.php中有一个自定义Form类,它在templates/Includes目录中有相应的自定义Form模板ForgotPasswordForm.ss.表单操作应该调用doForgotPassword,但是从不调用此函数,否则,我将被发送到google.com.这似乎是如此基本,但我有两个开发人员在看它,我们得到的是以下错误:
似乎存在技术问题.请单击后退按钮,刷新浏览器,然后重试.
我在这做错了什么?
ForgotPasswordForm.php
<?php
class ForgotPasswordForm extends Form {
function __construct($controller, $name, $arguments=array()) {
$fields = new FieldList(
EmailField::create("Email")
);
$actions = new FieldList(FormAction::create("doForgotPassword")->setTitle("RETRIEVE PASSWORD"));
$validator = new RequiredFields('Email');
parent::__construct($controller, $name, $fields, $actions, $validator);
}
public function doForgotPassword($data, Form $form) {
//As a test, if we ever get here, the controller should send me to the Google website
Controller::curr()->redirect('http://www.google.com');
}
public function forTemplate() {
return $this->renderWith(array(
$this->class,
'Form'
));
}
}
Run Code Online (Sandbox Code Playgroud)
ForgotPasswordForm.ss
<form $FormAttributes>
<label for="{$FormName}_Email">Enter Your Email Address</label> …Run Code Online (Sandbox Code Playgroud)