Hi Omar

yes, the parentesis you mentioned in the page 121 is one of the
errors, and you might find in the page 116 where it says Installing
the Prototype where it asks you to include a javascript line in your
default.ctp. you should encapsulate the line between <? and ?> and you
need to echo the line as well, so it ends up like:
<?=javascript->link(array('prototype'));?>

another thing that I had to change was the line 15 on the listing 8.7
page 120, that line did not work to me and I found a corrected one,
please try:

<?=$ajax->form('/comments/
add','post',array('update'=>'comments','url'=>'/comments/add'));?>

good luck

Carlos

On 8 nov, 14:49, "omar.laverde" <[EMAIL PROTECTED]> wrote:
> Hi Carlos,
>
> i am fallowing that book, i find one error, a missing right parentesis
> in the comments_controller.php but i can´t find the other two errors
> you mention, could you tell me please where are they.
>
> Thank You
>
> On 2 nov, 14:45, carlos ferrandis <[EMAIL PROTECTED]> wrote:
>
> > Hi. Are you following the exercise in the book: Implementing Ajax
> > Features, chapter 8? if so I might me able to tell you that I found 3
> > errors on it. Reading your code I fix the last one. let me know then I
> > can drop you the code corrected.
>
> > carlos
>
> > On 31 out, 15:13, Kieron <[EMAIL PROTECTED]> wrote:
>
> > > Hi,
>
> > > I am trying to add a commentsformto a blog post, updating the page
> > > withajax, specifically using prototype.js.
> > > I've usedajax->form, however when I press the submit button
> > > absolutely nothing happens.
> > > I've tried theajaxsubmit method with the same result. If I submit
> > > theformwithoutajaxit works fine.
>
> > > my view code is as follows:
>
> > >     echo $ajax->form('/comments/
> > > add','post',array('update'=>'comments','url'=>'/comments/add'));
> > >     echo $form->input('Comment.name');
> > >     echo $form->input('Comment.content');
> > >     echo 
> > > $form->input('Comment.post_id',array('type'=>'hidden','value'=>$post['Post']
>
> > > ['id']));
> > >     echo $form->end('Add Comment');
>
> > > the add action in the comments controller is as follows:
>
> > >         function add() {
> > >                 if (!empty($this->data)) {
> > >                         $this->Comment->create();
> > >                         if ($this->Comment->save($this->data)) {
> > >                                 $comments = 
> > > $this->Comment->find('all',array('conditions'=>array('post_id'=>$this->data['Comment']
>
> > > ['post_id']),'recursive'=>-1));
> > >                                 $this->set(compact('comments'));
> > >                                 $this->render('add_success','ajax');
> > >                         } else {
> > >                                 $this->render('add_failure', 'ajax');
> > >                         }
> > >                 }
> > >         }
>
> > > and the created source is as follows:
>
> > >   <div id="comments">
> > >     <formid="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) { 
> > > newAjax.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>
>
> > > Does anyone know what might be wrong?
>
> > > I'd appreciate any feedback as I've spent a whole day trying to solve
> > > this and have no desire to quit the whole cakephp thing over something
> > > like this!
>
> > > Thanks
> > > Kieron.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to