2

i am getting 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.

but i cant skip using rerender or oncomplete. how can i solve this.

<apex:actionRegion > 
  <apex:outputPanel id="Panel"> 
    <apex:repeat value="{!wrapperValues}" var="w"> 
      <apex:inputfile value="{!w.document}"/> 
    </apex:repeat> 
  </apex:outputPanel> 
  <apex:commandbutton style="width: 170px;" value="Add another" action="{!addAnother}" reRender="Panel" /> 
</apex:actionRegion>
  • can we use input type="file" instead of apex:inputfile – Pankaj Feb 4 '13 at 9:55
  • Please post some code. Help me help you. :-) – pchittum Feb 4 '13 at 10:04
  • <apex:actionRegion > <apex:outputPanel id="Panel"> <apex:repeat value="{!wrapperValues}" var="w"> <apex:inputfile value="{!w.document}"/> </apex:repeat> </apex:outputPanel> <apex:commandbutton style="width: 170px;" value="Add another" > action="{!addAnother}" reRender="Panel" /> </apex:actionRegion> – Pankaj Feb 4 '13 at 10:46
  • can we upload a file using html input type=file.if yes how we will bind it in backend – Pankaj Feb 4 '13 at 10:58
  • I copied your code from your comment into the question and added formatting. – pchittum Feb 4 '13 at 16:29
3

As the error indicates, you simply can't do this. I'd imagine its a security feature, as the inputFile is allowing uploading of a file from the user's computer. You could use an iframe to contain the input file component, which means that other frames would be unaffected, but from the technical point of view it has to be a full refresh of the containing page.

|improve this answer|||||
  • hi bob.cant we use input type="file",HTML tag – Pankaj Feb 4 '13 at 12:01
  • 1
    No, as this will be regular HTML form rather than a Visualforce form, so the file won't be bound to anything on the controller side. – Bob Buzzard Feb 4 '13 at 12:49
1

You can put the inputfile component in a separate page and include the new page in your original page with an component.

|improve this answer|||||

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.