脚本宝典收集整理的这篇文章主要介绍了php – Silverstripe 3.1自定义表单未执行的操作,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
似乎存在技术问题.请单击后退按钮,刷新浏览器,然后重试.
我在这做错了什么?
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 . . .
以上是脚本宝典为你收集整理的php – Silverstripe 3.1自定义表单未执行的操作全部内容,希望文章能够帮你解决php – Silverstripe 3.1自定义表单未执行的操作所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。