Jump to content

Error On From Post With Post As Method, Not For Get


Recommended Posts

Posted

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?

Posted

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).

Posted

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 ?

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...