Nazarene Gonzales
Nazarene Gonzales

Reputation: 137

Cakephp Blog Tutorial - Edit Routine

In the cakephp blog tutorial in the Edit Post edit() action section

http://book.cakephp.org/2.0/en/tutorials-and-examples/blog/part-two.html

I can't understand why this echo $this->Form->input('id', array('type' => 'hidden')); is included in the cakephp/posts/edit/ (edit.cpt) while it works just fine without it?

Upvotes: 1

Views: 268

Answers (1)

Dave
Dave

Reputation: 29121

I was going to answer with a reason, but I think you're right - it can work just fine without.

My only guess is that it shows you how to do it this way so you can see how you would do it regardless if you're on the posts/edit/[id] page.

For example, you could edit 3 posts per page or edit a post on any other page...etc. By passing the 'id' field, you don't have to submit the form to an action requiring the id.

I realize this isn't the best answer, but I'm not sure there is a better one.

Upvotes: 1

Related Questions