I am trying to build a page on which chatter files are displayed and on click of button i will be downloading them ,and clearing the page .I wrote an action function but for some reason not getting called.any idea why my download happens,but clearitem actionfunction never gets called and for that matter no deletion happens

<apex:page controller="Download" showHeader="false" sidebar="false" action="{!loadDownloaditems}">

  <apex:pageBlock title="Items to download" id="items">

        <apex:pageBlockTable value="{!chatterfileids}" var="items">

            <apex:column value="{!items}"/> 



    Items once downloaded will be cleared from the cart
<apex:form >

<apex:actionFunction name="clearitem()" action="{!clearitems}" rerender="msgs" />

    <apex:outputLink onClick="downloaditem();">
<apex:pageMessages id="msgs" />
<script type="text/javascript">
function downloaditem()
var SFObjectArray = new Array();
<apex:repeat value="{!chatterfileids}" var="arrayItem">

var url = "https://c.cs7.visual.force.com/sfc/servlet.shepherd/version/download/" 

for (var i = 0; i < SFObjectArray.length; i++)
var arr = SFObjectArray[i];
var full = url + arr;



You don't need to add braces to the actionfunctions name. Remove it and the function must work then:

<apex:actionFunction name="clearitem" 
                     rerender="msgs" />

But you DO need braces is you calls the actionfuction:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.