Any cake 2.x Ajax examples?

2013-04-29 Thread Yen Hua Chuah
Hi Is there any documents on how to use Ajax in Cake 2.x? I have been trying to read the cake user manual but it only shows methods and i cant really figure out how to use it. please help chris -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter

Re: Paginate component fetches all data not paged data

2013-04-29 Thread Reuben
The code didn't quite come through to the Google Group, but looking at the original post... class MyControllers extends AppController { public $components = array('Paginator'); public function index() { $this-paginate['MyModel'] = array('limit'=5); print_r($this-paginate('MyModel')); } }

Re: Any cake 2.x Ajax examples?

2013-04-29 Thread Reuben
Hi Most of the actual ajax is client side. So lets assume you are using jQuery, and are familiar with how that works. With CakePHP, the convention is to use file extension based routing to recognise XML or JSON requests. For this, define Router::parseExtensions() in your router.php, as seen

Re: Is it possible to add any date for saving in beforeSave method in app_controller.php

2013-04-29 Thread Reuben
You'd be better off doing it from the Model, and would only have to do the save once. From the controller, and using saveField(), you now have two saves happening.. one for your original data, and the other for the modified_by / created_by fields. Also, if you put it in the model, then the

Re: Paginate search results

2013-04-29 Thread Reuben
It looks like you are making a call to the PaginatorHelper in the view, when no actual pagination has taken place. And this happens when you submit the search form. Firstly, I would recommend not using a POST for your search form. Use a GET instead, so that everything is on the query string,

Re: Problem with Pagination of search results

2013-04-29 Thread Lilit
I only had $this-Paginator-numbers() in view. I'll try to make it via GET.. but after knowing how to use with sessions :) Thanks for your reply ! -- View this message in context: http://cakephp.1045679.n5.nabble.com/Problem-with-Pagination-of-search-results-tp5714685p5714704.html Sent from

edit form needs to be submitted two times while using security component

2013-04-29 Thread vinu
Hi Friends, Can anyone help me out with this , i have a edit form with security component , it needs to be submitted two times i have checked in console , in form security component hidden token METHOD IN by default PUT , when i click submit first time it changes to post ,then second time

Re: Problem with Pagination of search results

2013-04-29 Thread Reuben
Just having another look at your code that is using sessions... It looks as though when someone submits the form that contains the 'search' field, you are saving that to the session, but then checking for it's existence, reading it straight back out, and never doing the paginate. Here is