OK, thanks to michaelGregoire to helping me with the Data validation issue. I have a new one, however. I'm testing out the Ajax "add comment" functionality in the book on page 120. Specifically I'm looking at the code in the form (Listing 8-7).
<?=$ajax->form('/comments/add','post',array('update'=>'comments'));?>
<?=$form->input('Comment.name');?>
<?=$form->input('Comment.content');?>
<?=$form->input('Comment.post_id',array('type'=>'hidden','value'=>$post['Post']['id']));?>
<?=$form->end('Add Comment');?>
The form is created correctly but it fails with an error:
"The action comments is not defined in controller PostsController"
Looking at the source, I can see why:
<form id="form2050239561" onsubmit="event.returnValue = false; return false;"
method="post" action="/posts/comments/add"><fieldset style="display:none;"><input type="hidden" name="_method" value="POST" /></fieldset><script type="text/javascript">
//<![CDATA[
Event.observe('form2050239561', 'submit', function(event) { new Ajax.Updater('comments','/posts/comments/add', {asynchronous:true, evalScripts:true, parameters:Form.serialize('form2050239561'), requestHeaders:['X-Update', 'comments']}) }, false);
//]]>
I'm not sure where it's picking up the "/posts" and adding it to the URL. I'm looking at the docs over at
http://book.cakephp.org/view/208/ajax but nothing is jumping out at me.