views:

22

answers:

2

I use requestAction with parameter return $this->requestAction (....,array('return'); request action in plugin . plugin render view has $js->submit('Save',array('updade'=>'#fsjkfsj');

but it dont show any javascript when i view source code. I tested with code $js->alert('ksldjflkjs'); but it dont , too how make requestAction width JS Helper or it is impossible ?

A: 

are you on cake 1.3 using the new $js engine helper? if so, i remember reading about bueffering and needing to explicitly write the buffer to the view. This is what the manual says:

It is recommended that you place $js->writeBuffer() at the bottom of your layout file above the tag. This will allow all scripts generated in layout elements to be output in one place. It should be noted that buffered scripts are handled separately from included script files.

the request action method might be buffering your scripts for the same reason. try this out and let the community know if it is the case seeing how the manual does not mention it.

Good luck!

btw, here is the link where i found the reference http://book.cakephp.org/view/1596/Javascript-engine-usage

Angel S. Moreno
A: 

in this case, I use $this->Js->writeBuffer() in file view.ctp of plugin . It'll output javascript buffered, but dont in one place , it in bottom file view.cpt of requestAction.

meotimdihia