Chapter 9 : Form Helpers

2 messages Options
Embed this post
Permalink
New CakeUser

Chapter 9 : Form Helpers

Reply Threaded More More options
Print post
Permalink
Hello David, all,
i bougth your books there is few weeks, great, i come from php, and i like the way Cake conduct me for future development
i have a question about the Form Helper, you say at page 152 on chapter 9, we can add a secure field to the form,
but when i try it, it's does not product any new line.. just nothing..
i see in the code miss a ')', but not resolve the secure tag
the code "$form->secure(array('Post'=>array('id','name')))"
produce no error code or nothing..
i look around, google and blog, either in the cake manual, but found nothing related on this function
did it on the 1.2 version ?
thanks in advance for your reply
(and sorry for my english.. i m french)
enjoy cake
davidgolding

Re: Chapter 9 : Form Helpers

Reply Threaded More More options
Print post
Permalink
All $form->secure() does is to provide a hidden form field (in other words, <input type="hidden" />) to the form with a submission token. Then, in your model, before the save, you can check

$this->data['_Token']['fields']

to make sure its value is consistent with your server-side hash generating algorithm. But this is a more advanced technique that I avoided really expounding on in the book, since it's a beginner's book, hence the little detail in the book about $form->secure().
--Dave

Author, "Beginning CakePHP: From Novice to Professional"

[ get your copy at: http://www.amazon.com/Beginning-CakePHP-Novice-Professional/dp/1430209771/ ]