function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

ABORT <apex:commandLink> action



I want to abort the Ajax request cause by clicking a commandLink.


I was thinking in something like this....



<script> function startRequest () { alert('startRequest'); } function endRequest () { alert('endRequest'); } function abortRequest () { var currentAjaxPost = ......; currentAjaxPost.abort(); } </scrip> <apex:form> <apex:outputpanel id="fooPanel"></apex:outputpanel> <apex:commandLink action="{!foo}" onclick="startRequest();" oncomplete="endRequest();" rerender="fooPanel"/> <a href="javascript:;" onclick="abortRequest();">ABORT</a> </apex:form>


After clicking on comandLink, while the action is being executed, if I click on ABORT link, I want the ajax request to be cancelled( preventing the endRequest(); function to be called ) .



 Any idea??






Ron HessRon Hess
i think you can return false from the onclick and it may cancel the post, not 100% sure

Yes, if i put return false in the onclick of the commandLink like this:

<apex:commandLink onclick="return false;" the link DOESN'T DO the post.

But i want to CANCEL the post (once i click the commandLink and before the oncomplete event)...

Message Edited by JmBessonart on 05-11-2009 12:22 PM