我有一个名为ForgotPasswordPage.PHP的自定义页面和一个ForgotPasswordPage.ss模板.我还在ForgotPasswordForm.PHP中有一个自定义Form类,它在templates / Includes目录中有相应的自定义Form模板ForgotPasswordForm.ss.
表单操作应该调用doForgotPassword,但是从不调用此函数,否则,我将被发送到google.com.
这似乎是如此基本,但我有两个开发人员在看它,我们得到的是以下错误:
原文链接:https://www.f2er.com/php/240231.html表单操作应该调用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,$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' )); } }
ForgotPasswordForm.ss
<form $FormAttributes> <label for="{$FormName}_Email">Enter Your Email Address</label> $Fields.dataFieldByName(Email) <% if $Actions %> <% loop $Actions %> $Field <% end_loop %> <% end_if %> </form>
ForgotPasswordPage.PHP
class ForgotPasswordPage extends Page { . . . } class ForgotPasswordPage_Controller extends Page_Controller { public static $allowed_actions = array ( 'MyForgotPasswordForm' ); public function init() { parent::init(); } public function MyForgotPasswordForm(){ return new ForgotPasswordForm($this,'MyForgotPasswordForm'); } }
ForgotPasswordPage.ss
. . . $MyForgotPasswordForm . . .