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
Maurizio BellaMaurizio Bella 

custom delete attachment

I did a custom page where I can insert an attachment related to a custom object.
The problem is related to the delete button. I can't do it because the page goes crash with this error:
 
"apex:inputFile can not be used in conjunction with an action component, apex:commandButton or apex:commandLink that specifies a rerender or oncomplete attribute"
 
I think that the problem is related to reRender="form" in page. Someone have been never developed a custom delete button?
 
Thanks for any suggest or idea


[CODE]
<apex:page Controller="ControllerTEST"  showHeader="false">
    <apex:sectionHeader title="File" subtitle="User manage" help="/help/doc/user_ed.jsp?loc=help"></apex:sectionHeader>
<apex:form id="form">
    <apex:pageBlock title="Your files">
       <apex:pageBlockTable value="{!QFile}" var="att" rendered="{!NOT(ISNULL(QFile))}">
                <apex:column >
                    <a href="javascript&colon;if (window.confirm('Are you sure?')) DeleteFile('{!att.Id}');" style="font-weight:bold">Del</a>
                </apex:column>
                <apex:column headerValue="Action">
               <apex:outputLink value="{!URLFOR($Action.Filement.Download, att.Id)}" target="_blank">View</apex:outputLink>
            </apex:column>
                <apex:column title="ID" value="{!att.id}"/>
                <apex:column title="File Name" value="{!att.Name}"/>
                <apex:column title="Description" value="{!att.Description}"/>
                <apex:column title="Lenght (inbytes)" value="{!att.BodyLength}"/>
        </apex:pageBlockTable>
    </apex:pageBlock>
       <!-- <apex:actionFunction action="{!DeleteFile}" name="DeleteFile" reRender="form" > -->
        <apex:actionFunction action="{!DeleteFile}" name="DeleteFile" reRender="form">
            <apex:param name="SelectedFileId" value="" assignTo="{!SelectedFileId}"/>
        </apex:actionFunction>       
    </apex:form>
</apex:page>
[/CODE]

Best Answer chosen by Admin (Salesforce Developers) 
Starz26Starz26

This answer :

 

Wrap the actionFunction and the thing it rerenders within a single actionRegion.

 

posted here may help: http://boards.developerforce.com/t5/Visualforce-Development/apex-inputFile-cannot-be-used-with-that-specifies-a-rerender-or/td-p/98161

All Answers

Maurizio BellaMaurizio Bella

someone can help me?

thanks

Starz26Starz26

This answer :

 

Wrap the actionFunction and the thing it rerenders within a single actionRegion.

 

posted here may help: http://boards.developerforce.com/t5/Visualforce-Development/apex-inputFile-cannot-be-used-with-that-specifies-a-rerender-or/td-p/98161

This was selected as the best answer
Bv1 TriggersBv1 Triggers
HI All,

Thanks for sharing the information.Could you please send me clear code,now i am fasing same problem.

thanks..