I am using Cake 2.3.0. If I submit my form using POST , the fields of the selected form are transferred, however, if I submit my form using GET , all form fields will return to their default values.
Is there a way to make the GET view the same as POST ?
Here is my contorller:
class ListingsController extends AppController { public function results() { $conditions = array( 'Listing.Beds >=' => $this->request->query['beds'], 'Listing.ListingStatus >=' => $this->request->query['status'], ); $this->paginate = array( 'conditions' => $conditions, ); $this->set('listings', $this->paginate()); } }
This is what my mind looks like.
echo $this->Form->create(null, array( 'controller' => 'listings', 'action' => 'results', 'type' => 'get' )); echo $this->Form->input('name'); $beds = array('1' => '1+', '2' => '2+', '3' => '3+', '4' => '4+', '5' => '5+'); echo $this->Form->input('beds', array('options' => $beds)); $status = array('Active' => 'Active', 'Pending' => 'Pending', 'ActivePending' => 'Active and Pending'); echo $this->Form->input('status', array('options' => $status)); echo $this->Form->end('Update');
So basically, if I change 'type' => 'get' to 'type' => 'post' , it works fine. But I need to do this via GET .
thanks
source share