Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

refresh a form when clicking on back

Hi I have a problem position data from the database in my view and that every time they enter the form but these not refreshed every you see someone gives you click the button back browser are generated, because I are doubling certain unique data .

How refresh the view when clicking the back button.?

edited Oct '16

Hey, this is more of frontend problem, rather than Phalcon (backend) one. You can hack it with javascript:

You can add CSRF token protection to your form with Phalcon. This way if user submits form twice it will not validate. But this will not cover the case of user pressing back button on browser, you have to use above link. Quick example of CSRF protection in use:

// Template
<input type="hidden" name="{{ security.getTokenKey() }}" value="{{ security.getToken() }}"/>

// Controller
if ($this->request->isPost() AND $this->security->checkToken()) {