AllToolKits.com Posted September 10, 2015 Report Posted September 10, 2015 Developing a plugin, in that i have a form with below code <form action="<?php echo $this->Html->safe($this->base_uri . "plugin/pname/client_pnaname/updatebalance") ?>" method="post"/> Amount: <input type="text" name="amount" /> <input type="submit" class="btn btn-default" name="update" value="Update" /> </form> But i post, i get an error Oh noes! Files does not exist: C:\inetpub\wwwroot\plugins\pname\views\client\bootstrap\message.pdt on line 120 in C:\inetpub\wwwroot\lib\view.php I do have a a file controller folder with class ClientPname extendsPnameController { and a function in it with name updatebalance It works if the method is get, but getting error for post only. any idea why it's so? Quote
Tyson Posted September 10, 2015 Report Posted September 10, 2015 See this thread. It looks like you are setting a message in your controller without noting that it should be displayed in Blesta's default message template. Because of this, it expects that you have created your own message template in your plugin, which does not exist. Look at your calls to setMessage and flashMessage and ensure you are setting each parameter, specifically false to the last one ($in_current_view). Quote
AllToolKits.com Posted September 11, 2015 Author Report Posted September 11, 2015 Hi, I got that error because of submitting a form without csrf token it. I fixed it by adding public function preAction() { if($this->action == "updatebalance"){ Configure::set("Blesta.verify_csrf_token", false); } parent::preAction(); } I wish to use csrf in the form, how i can add that to the form ? Quote
Blesta Addons Posted September 11, 2015 Report Posted September 11, 2015 just use Form helper , it will do that for you . $this->Form->create(null, array('id' => "form", 'enctype' => "multipart/form-data")); activa 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.