Re: ajax form submission - nothing happens
Hi I fiugured out what my error was, i download the ajax javascript file and i didn´t re named when i download it the name was prototype-1.6.0.3.js so i change it to prototype.js, and then all just work fine. Thanks On 8 nov, 11:29, "omar.laverde" <[EMAIL PROTECTED]> wrote: > Thank you so much carlos, > > it seems i have change the 3 errors that you mention, but i dont know > why i have still the error that thesubmitbuttondoesn`t do nothing, > the code that i change in the files are this way: > > - app/views/posts/view.ctp > > form('/comments/ > add','post',array('update'=>'comments','url'=>'/comments/add'));?> > input('Comment.name');?> > input('Comment.content');?> > $form->input('Comment.post_id',array('type'=>'hidden','value'=>$post['Post'] > > ['id']));?> > end('Add Comment');?> > > - app/views/layouts/default.ctp > > > My Cake Blog Application > css('cake.generic'); ?> > link(array('prototype')); ?> > > > - app/controllers/comments_controller.php > > 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'); > } > } > > } > > The form html source code is this way > > style="display:none;"> value="POST" /> > // Event.observe('form123915682', 'submit', function(event) { new > Ajax.Updater('comments','/Blog/comments/add', {asynchronous:true, > evalScripts:true, parameters:Form.serialize('form123915682'), > requestHeaders:['X-Update', 'comments']}) }, false); > //]]> > Name label> value="" id="CommentName" /> for="CommentContent">Content div> id="CommentPostId" /> value="Add Comment" /> > > - And in the mozilla firebug i get these errors: > > - syntax error > var $name = 'Js';\n > - Event.observe is not a function > Event.observe('form1428557839', 'submit'...rs:['X-Update', > 'comments']}) }, false); > > I dont know where else could the error be, thank you so much for your > help. > > On 8 nov, 10:55, carlos ferrandis <[EMAIL PROTECTED]> wrote: > > > 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 you > > need to echo the line as well, so it ends up like: > > 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: > > > 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 thesubmitbutton > > > > > absolutely nothing happens. > > > > > I've tried theajaxsubmit method with the same result. If Isubmit > > > > > 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))
Re: ajax form submission - nothing happens
Thank you so much carlos, it seems i have change the 3 errors that you mention, but i dont know why i have still the error that the submit button doesn`t do nothing, the code that i change in the files are this way: - app/views/posts/view.ctp form('/comments/ add','post',array('update'=>'comments','url'=>'/comments/add'));?> input('Comment.name');?> input('Comment.content');?> input('Comment.post_id',array('type'=>'hidden','value'=>$post['Post'] ['id']));?> end('Add Comment');?> - app/views/layouts/default.ctp My Cake Blog Application css('cake.generic'); ?> link(array('prototype')); ?> - app/controllers/comments_controller.php 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'); } } } The form html source code is this way // NameContent - And in the mozilla firebug i get these errors: - syntax error var $name = 'Js';\n - Event.observe is not a function Event.observe('form1428557839', 'submit'...rs:['X-Update', 'comments']}) }, false); I dont know where else could the error be, thank you so much for your help. On 8 nov, 10:55, carlos ferrandis <[EMAIL PROTECTED]> wrote: > 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 you > need to echo the line as well, so it ends up like: > 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: > > 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: > > > > > > > > > > > > > > > > > >
Re: ajax form submission - nothing happens
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 you need to echo the line as well, so it ends up like: 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: 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: > > > > > > > > > > > > > > > > > > > > > > // > > 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); > > > //]]> > > > > > > > > > Name > > > > > value="" id="CommentName" /> > > > > > > > > > Content > > > > > id="CommentContent" > > > > > > > > > id="CommentPostId"/> > > > > > > > > > > > > > > > > > > > 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 cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: ajax form submission - nothing happens
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: > > > > > > > > > > > > > > > // > 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); > > //]]> > > > > > > Name > >> value="" id="CommentName" /> > > > > > > Content > >> id="CommentContent" > > > > > > id="CommentPostId"/> > > > > > > > > > > > > > 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 cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: ajax form submission - nothing happens
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: > > > > > > > > // 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); > //]]> > > > Name > value="" id="CommentName" /> > > > Content > id="CommentContent" > > > id="CommentPostId"/> > > > > > > > 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 cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
ajax form submission - nothing happens
Hi, I am trying to add a comments form to a blog post, updating the page with ajax, specifically using prototype.js. I've used ajax->form, however when I press the submit button absolutely nothing happens. 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: 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: // Name Content 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 cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---