0

Following up on my previous question, I am supposedly passing the submitted post data as query strings like so:

 echo $this->Form->create('Donor',array(
        'url' => array_merge(array('action' =>'find'), $this->params['pass'])
  ));

But when I try the following within my controller's find action :

 $this->Paginator->settings['conditions'] = $this->Donor->parseCriteria($this->Prg->parsedParams());

The $this->Prg->parsedParams() only consists of the criteria:

here's the var_dump

array (size=1)
  'criteria' => string 'blood_group_id' (length=14)

And here is my view code :

            <?php
                echo $this->Form->create('Donor',array(
                    'url' => array_merge(array('action' =>'find'), $this->params['pass'])
                ));
                echo $this->Form->input('criteria',array(
                        'label'=>'Search Criteria',
                        'options' => array(
                            'id'=> 'By ID',
                            'name' => 'By Name',
                            'blood_group_id' => 'By Blood Type',
                            'type' => 'By Donor Type',
                            'age' => 'By Age',
                            'gender' => 'By Gender' 
                        )
                    ));
             ?>

                <?php echo $this->Form->input('query', array( 'id' => 'query', 'name' => 'query', 'label' => false, 'placeholder' => 'Search')); ?>
                <?php echo $this->Form->end(__('Search'));?>

I believe that I should be receiving all submitted data and not only the criteria's value.. I do not know what is wrong, and frankly this is taking so much time to put together. I cant seem to figure out how to work with this plugin. Is it just me ? Please, if anyone could find the time to help out, I will be grateful!

Community
  • 1
  • 1
LogixMaster
  • 586
  • 2
  • 11
  • 36

1 Answers1

0

The Answer was almost under my nose.. I inattentively was naming the 'query' input twice,

<?php echo $this->Form->input('query', array( 'id' => 'query', 'name' => 'query','label' => false, 'placeholder' => 'Search')); ?>

I removed the 'name' key, and everything worked fine! That was one stupid mistake, which wasted about an hour for me, so im hoping this would help someone who comes across something like this! Thanks

LogixMaster
  • 586
  • 2
  • 11
  • 36