So, I've got the following bit of code:
<?php $this->start('search'); ?>
<?php
$data = $this->Js->get('#ItemIndexForm')->serializeForm(array('isForm' =>
true, 'inline' => true));
$this->Js->get('#ItemIndexForm
#ItemName')->event('keyup',$this->Js->request(array('action' => 'index'),
array('update' => '#content', 'data' => $data, 'async' => true, 'method' =>
'POST')));
$this->Js->get('#ItemIndexForm')->event('submit',
$this->Js->request(array('action' => 'index'), array('update' =>
'#content','data' => $data,'async' => true, 'method' => 'POST')));
?>
<?php echo $this->Form->create('Item'); ?>
<?php echo $this->Form->input('Item.name'); ?>
<?php echo $this->Form->submit(); ?>
<?php echo $this->Form->end(); ?>
<?php $this->end(); ?>
I'm calling writeBuffer at the end of the view for ajax pagination.
That creates a search form that creates a search block that is fetched into
my layout, I did it this way so that when we update #content the search
form doesn't get reloaded and lose focus. (not sure if that was the best
way to do it or not).
It works, however the first key press results in one request, the second in
two, the third in four request, and so on. Same for submitting with the
submit button, each submission results in an exponential number of requests.
I'm pretty sure I know why it's doing it but not sure why it would actually
work that way. My theory is that when it receives the data back its
binding again to the search form thats coming from the reply even though
that part is getting stripped out. It's getting stripped out because its
not inside #content. However that doesn't really seem to be the case.
How can I resolve this issue?
--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.