Hi,
In chapter 8, I have followed the code and tried to submit the comment form but nothing happens, it appears that not even the prototype funcs are called let alone the add function in the comments controller.
I've tried the ajax submit method with the same result. If I submit the form without ajax it works fine.
my view code is as follows (without the input fields and end):
echo $ajax->form('/comments/add','post',array('update'=>'comments','url'=>'/comments/add'));
and the created source is as follows:
<div id="comments">
<form id="form283226270" onsubmit="event.returnValue = false; return false;" method="post" action="/blog/comments/add">
<fieldset style="display:none;">
<input type="hidden" name="_method" value="POST" />
</fieldset>
<script type="text/javascript">
//<![CDATA[
Event.observe('form283226270', 'submit', function(event) { new Ajax.Updater('comments','/blog/comments/add', {asynchronous:true, evalScripts:true, parameters:Form.serialize('form283226270'), requestHeaders:['X-Update', 'comments']}) }, false);
//]]>
</script>
<div class="input text">
<label for="CommentName">Name</label>
<input name="data[Comment][name]" type="text" maxlength="100" value="" id="CommentName" />
</div>
<div class="input textarea">
<label for="CommentContent">Content</label>
<textarea name="data[Comment][content]" cols="30" rows="6" id="CommentContent" ></textarea>
</div>
<input type="hidden" name="data[Comment][post_id]" value="7" id="CommentPostId"/>
<div class="submit">
<input type="submit" value="Add Comment" />
</div>
</form>
</div>
Has anyone had similar problems? Does anyone know what might be wrong?
I'd appreciate any feedback as I've spent a day trying to solve this and have no desire to quit the whole cakephp thing over something like this!
Thanks
Kieron.