Jump to content

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


AllToolKits.com

Recommended Posts

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 ?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...