Sorry I do not see an answer. I never got one...will check the Google board. For some reason my emails from the cake group are sparatic...don't seem to be getting all of them for some reason.
Dave -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of John Andersen Sent: January-11-10 2:45 PM To: CakePHP Subject: Re: Please help..stuck and no luck Ok, did my answer above solve your issue? John On Jan 11, 8:08 pm, "Dave" <[email protected]> wrote: > Will do that...just added more info to detail the problem so I thought > best to start new but wont do that any more...will continue on. > > But back to the question. > > Just the controller is correct. My JS works fine when I send true or > false responses' (minus the html view code) so all I need to add is > the html > (view) that would normally be returned as if the request was http into > the json response so the js can spit out the correct html into the > correct div on the page. > > Thanks, > > Dave > > -----Original Message----- > From: [email protected] [mailto:[email protected]] On > Behalf > > Of John Andersen > Sent: January-11-10 2:32 PM > To: CakePHP > Subject: Re: Please help..stuck and no luck > > Hi Dave, > > Please don't start another thread on the same issue, when no-one has > answered the previous one. Just add your message to the existing > thread so it bounces to the top of the list :) > > Now, if I understand it correctly, and I don't have Ajax running yet > on my site, then you just need to use the controllers method - render > ( view name > ) and save the result in your responce variable. > > Enjoy, > John > > On Jan 11, 7:22 pm, "Dave" <[email protected]> wrote: > > I will explain in detail what i am trying to do. > > > Index page has a table with rows of the users entries. I have a "Add > > New Entry" which will toggle the add form so the user can add > > entries directly from the same page via Ajax. I need 2 things to > > happen based on the form being submitted. > > 1. If the form saves i need to toggle close the form and append the > > new data saved to the table of entries. > > or > > 2. if the form does not save simply display the form as is where it > > is with the errors hi-lighted. > > > I have no problems with any of the Ajax / appending script i am just > > stuck on returning the views. > > Everyone so far says use json in response for true or false so the > > js will either update the users entries or do nothing if response > > comes back > false. > > But how do i get the views? How do i update the form with its errors > > if i simply return false? > > > Firebug sure shows my success = false if the form does not save but > > the end user has no idea why they are just sitting looking at the > > form with no errors marked so i need to respond back with the form > > html that would normally show up if it was sent thru normal http request. > > > Same thing goes with the success = true How do i return the view for > > the newly added record if it does save? > > > I wish i had a controller to show you but nothing i have works all i > > have is just testing true / false responses trying / hoping > > something / someone will help > > > if ( $this->RequestHandler->isAjax() ) { > > > Configure::write ( 'debug', 0 ); > > $this->data['Dummy']['id'] = > > $this->Dummy->generateKey('11'); > > $this->data['Dummy']['profile_id'] = > > $this->Auth->User('id'); > > > $response['data'] = $this->data['Dummy']; > > $response['success'] = true; > > //$response['success'] = false; > > //$response['html'] = ???; how do I get the view > > > $this->header('Content-Type: application/json'); > > echo json_encode($response); > > > } > > > My js has: > > > dataType: "json", > > success: function(response) { > > // Response was a success > > if (response.success === true) { > > alert('saved ok'); > > //do some stuff > > } else { > > alert('did not save'); > > //do some stuff > > } > > } > > > Surly someone out there has some idea. > > > Thanks > > > Dave > > No virus found in this incoming message. > Checked by AVG -www.avg.com > Version: 9.0.725 / Virus Database: 270.14.130/2607 - Release Date: > 01/11/10 04:05:00 No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.725 / Virus Database: 270.14.130/2607 - Release Date: 01/11/10 04:05:00
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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
