Microsoft.AspNet.ScriptManager.WebForms not firing add_endRequest - webforms

I have recently added Microsoft.AspNet.ScriptManager.WebForms and since that moment add_endRequest aren't being fired and I have a lot of things that are based on this.

make sure the javascript that uses add_endRequest is after the scriptmanager. (the scriptmanager i'm using is from the ajax control toolkit.)

Related

How to reset or re-initialize a Jquery plugin being used on AJAX-updated links?

I am using this plugin for adding arrow key navigation to a website
Works great! However, sometimes my links are updated via AJAX and then the highlighting disappears. So I started re-initializing the plugin when my links were updated. I noticed this solved the problem, however now I had multiple copies of the plugin running, thus highlighting multiple buttons at once.
I know there isn't a 'built in' destory method in Jquery, but does anyone have any ideas on how to re-initialize a plugin or at least get rid of the old instance running.
You can see the source code of the plugin on GitHub
The plugin code is simple and I believe what I am trying to achieve is simple as well. Thanks!
The plugin you are using has an update function, call that function as soon as you get the ajax result back.
for example
var $keyNav = $('#navigation a').keynav();
and on ajax success
$keyNav.update();
I haven't tested this code but I think it will work.

Handling basic ajax events in Primefaces Components

First of all I'm still learning the structure and how it works.
I searched around the web to get an suitable and easy answer to the following question:
Is there a way to regonize all other basic ajax events, like hovering and clicking on Primefaces Components?
For example, i would know the event which get invoked if you click on the previous or next button on an <p:schedule>. The documentation says there are only "dateSelect, eventMove, eventResize" and "eventSelect" as callable ajax events. But this is not enough, if you want to build an complex application and you combine an <p:calendar> with an <p:schedule>. There you need to know when the schedule switches the month or year.
I hope someone can give me an clear and understandable answer to this.
Thanks and best regards.
Since you did not specify what event you need, your answer is going to be as clear as the question.
The primefaces objects can only recognize the events they are programmed to. If you need to get a specific type of event, you can:
1) see if the primefaces support that event. put it in a <p:ajax tag, and see if it works.
2) see if the standard JSF ajax API support it.
3) If all else fails, you can try to put a jQuery script along with the page, to handle the event and make a call from the client side.
The <p:calendar and <p:schedule makes heavy use of jQuery plugins to render it, I doubt you can get the events on the month selector or anything else in the rendered interface without client-side jquery.

Cakephp 2.x and Jquery Ajax - Cake doesn't think request is ajax

I am working on a little cakePHP application and am trying to AJAX it up a bit with JQuery to make it work a bit nicer for users.
I have just followed this tutorial: Cakephp Jquery AJAX Tutorial but for some reason it isn't working.
One great bit about the tutorial is that functionality falls back to normal CakePHP if the request isn't an AJAX request so my app still works but it doesn't work the AJAX way...
It looks like in my Controller, the request doesn't pass the test:
if($this->request->is('ajax'))
and so continues onto the normal $this->redirect(...) of the non-AJAX way.
Could it be something to do with the if statement for 'ajax'? In the tutorial the author is using a version of cakePHP before 2.0 and so uses $this->RequestHandler->isAjax() but this was deprecated as of cakePHP 2.0.
Thanks for your time.
JsHelper::link might do what you want.
As I think you have discovered, it's nothing to do with Cake. It's because in the tutorial he tells you to make a link, then you are clicking the link to run the action. This causes the AJAX request to fire, but also the actual link gets followed.
You need preventDefault() in your jQuery click event, to stop the browser from following the link in the normal way. This will not affect the link if the user doesn't have JavaScript... because they won't have the click event occur in the first place :)

Yii make submit disabled when post is processing

Is any way to do it with Yii framework: make submit disabled, after validating success and sending form to server?
I need it to stop multi submitting (double, tripple clicking on submit button).
Thanks!
No, this functionality is not built in to the CActiveForm code by default.
I just tackled this problem, actually, and ended up having to override CActiveForm to use a custom version of jquery.yiiactiveform.js. I thought about rolling it up into an extension, but it's pretty custom so it would be tough, and I'd have to re-release it with every new Yii release if they change jquery.yiiactiveform.js at all.
After seeing your post here, I did just file an enhancement request with Yii:
http://code.google.com/p/yii/issues/detail?id=2924
Attached to that request is the code I wrote if you want to try and use it yourself.
Good luck!

Yii ajaxlink in partial

I'm using Yii framework and have small problem.
Then I include to the partial CHtml::ajaxLink, link stopping work as ajax, standart click is raised and performs redirect to another page.
Can anyone help me? Thanks.
Just a supposition, but turn processOutput on when using partialRender with javascript. It's the fourth parameter when calling renderPartial:
$this->renderPartial('_view',array(params...),false,true)
ProcessOutput allows you to also load javascript when rendering with asynchronous calls or other stuff.
Turn firebug on and check for js errors. If there are any, post them here
There was something wrong with yii CHtml::ajax implementation, and it caused me similar bug to yours.
Maybe you not finishing document right?
try with:
Yii::app()->end();
And check differences in generated HTML between old version (which worked) and this one.
Maybe some js lib not included?

Resources