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?
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).
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 ?
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
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now