Thanks again for taking the time to reply. I think I have to do some more reading on the views because from you describe I think that I need a view for my edit page and then I need another view that's the same but just for AJAX. That violates DRY which I doubt CakePHP would make me do. So I must be missing something in how this fits together.
Unless somehow CakePHP just stuffs the AJAX view into the edit view? I don't know I will play around with your suggestion. -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of brian Sent: Sunday, January 04, 2009 3:01 AM To: [email protected] Subject: Re: Adding table row with AJAX On Sat, Jan 3, 2009 at 11:15 PM, Steven Wright <[email protected]> wrote: > > Actually this works in place of the dummy file > > $this->autoRender = false; Yes, that's correct. The reason (AFAIK) that RequestHandler doesn't suppress that automatically is that one should use a .ctp file for the output. You're better off setting a variable in your controller and handing it off to a view: $this->set('row_count', $row_count); $this->set('the_content', $the_content); $this->render('the_view_ajax'); the_view_ajax: <tr id="row<?= $row_count ?>"><td><?= $the_content ?></td></tr> This keeps HTML cruft out of your methods, which is always a Very Good Thing. I think RequestHandler might use a view named, 'the_view' + '_ajax' if it finds it, so you might not need the render() call. I'm also pretty sure it takes care of setting $layout = 'ajax', btw. Try removing that line and see if everything still works. (yeah, I'm too lazy to go check that. What do you expect from someone who uses short tags? ;-) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
