Question: If I am setting the Post model in my controller as follows;

```
    $this->Post->id = $id;

```

Can I access the data from Post or do I have to perform execute;

```
     $this->Post->read()

```

I'd like to perform some further validation on Post to determine the logic which is being executed. 

e.g. If the Post['submitted\_by'] = $this->Auth->user('role') == 'admin') **"pseudo code"**

Answer: 
You can't disable the back button. You can, however, remove the current document from the browser history and replace it with your desired document by using [`window.location.replace`](https://developer.mozilla.org/en/DOM/window.location#Methods). Keep in mind that you need to use AJAX in this case, since `replace` has to be called from the document you want to replace.

Instead of meddling with JavaScript and trying to mangle the user's browser, why don't you check on the server side whether the user is already logged in and redirect him to your main page?
```
Just try this,it works fine for me :)
Disable Back functionality using history.forward

```

This is another technique to disable the back functionality in any webpage. We can disable the back navigation by adding following code in the webpage. Now the catch here is that you have to add this code in all the pages where you want to avoid user to get back from previous page. For example user follows the navigation page1 -> page2. And you want to stop user from page2 to go back to page1. In this case all following code in page1.

```
<SCRIPT type="text/javascript">
    window.history.forward();
    function noBack() { window.history.forward(); }
</SCRIPT>
</HEAD>
<BODY onload="noBack();"
onpageshow="if (event.persisted) noBack();" onunload="">

```

The above code will trigger history.forward event for page1. Thus if user presses Back button on page2, he will be sent to page1. But the history.forward code on page1 pushes the user back to page2. Thus user will not be able to go back from page1.
To see online Demo-
<http://viralpatel.net/blogs/demo/javascript-disable-browser-back-button/>