Wednesday, October 9, 2013

Can't get to make before and complete work with get

Hello all,

Maybe not the most clear subject line but here is my problem. I have a 'change' event on an input field. It works fine except I can't get the 'before' and 'complete' callback to hide/show a div. If a use alert just for testing, everything is fine, so the script is OK.

Here is the code from the view.

$this->Js->get('#name')->event('change', $this->Js->request(array(
'action' => 'changeTerms', 'name'
), array(
'async' => true,
'method' => 'post',
'update' => '#offer',
        'before' => $this->Js->get('#loading')->effect('fadeIn', array('buffer' => false)),
        'complete' => $this->Js->get('#loading')->effect('fadeOut', array('buffer' => false)),
'dataExpression'=>true,
'data'=> $this->Js->serializeForm(array(
'isForm' => true,
'inline' => true,
)),
)));

I get why this is not working, the generated js is wrong. The last two $this->Js->get('#loading') are to blame , but how can I fix it?

Thanks,
Andrei

--
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 cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: