You need to sign in to do that
Don't have an account?

apex:inputFile can not be used in conjunction with an action component...
Hi all,
I have a problem about upload file using apex:InputFile control, when i add this control (apex:InputFile) to form that uses renderer attribute, there is an error occurs:
apex:inputFile can not be used in conjunction with an action component, apex:commandButton or apex:commandLink that specifies a rerender or oncomplete attribute
Pls help me to solve this problem.
The error says it all, remove the rerender (and oncomplete if applicable) attribute or move the inputFile to another page with a form that doesn't have rerender/oncomplete on the action.
hi mtbclimber,
In my busines, customer want to use ajax and upload file in only one Visual page.
I also try to move upload file to another page, and in main page i use <apex:include> but that error still orcurs.
So, how to solve????
I didn't mean to suggest you drop to an include. I meant you can either use rerender or you can use inputfile. They can not be used together, as the error states.
If you want to maintain the appearance of partial page updates the only real solution is to use an iframe but in the end there is no solution here technically besides doing a full page refresh.
There is another way I've used in the past, but it breaks a best practice rule. Create another apex:form, put your inputfile inside of it, change the target on the form to an invisible iframe. Have the iframe load to another page that calls a method for refreshing the file list on the parent frame (parent.refreshAttachments), etc.
I wish there was a parameter on the inputfile to prevent full page rerender. Then we could at least trigger something onclick to refresh the attachments.
By wrapping this in actionRegion, it seems to work. Is this officially unsupported?
I have a selectRadio with actionSupport. If some of the options are selected, I require an attachment (inputFile) - so I want to refresh the page.
If I wrap selectRadion with actionRegion, it works...if not, I get the message in this thread.
I think it's in a gray area. Developer support will always mention this if they see two forms. It's not the best practice because it creates two copies of the viewstate. I can say I've successfully run a VisualForce page like this with 220 active users using it 24x5 (around 80 using it concurrently at a time), without any issues from it. In my new version I moved to an iframe that auto-resizes. I had a use for a few of these iframes though so that is the reason I went that route.
I mis-read your reply. I think that method is the preferred way to handle inputfile on a form with re-rerendering. I've sent you an example our company uses in production over PM for attaching files on a form that has re-rendering components.
-Richard
Thanks Richard. I just sent you a note back through the private message.
I'm having the same problem. Is it possible for you to post the example here or send it to me directly. Have to upload a file but not refresh the entire page.
Thanks
Here is pseudocode. Essentially, if the user selects certain options in select Radio, the inputfile is shown, else it is not.
Wrapping selectRadio with action Region works, else you get the error.
I've tried this but it's still not working. I was looking for the hidden iframe solution.
Hi Akki,
Any possible solution for this ? Please share
Havent been able to come up with a solution yet, after the inputFile, my entire visualforce page is refreshed.
Maybe my way to avoid the same error will be helpful for you.
please check following point with consideration of sample code
1.control the inputfile component to be shown
To show them after a button click and to hide them before next page rendering
2. do not use rerender attribute on the second button.
I am not sure about the reason. but my code work wery well
Hey ,
Can you please post the Complete Controller code.
Thanks In Advance.
You have to use form tag before input file section <apex:form>, please try it once,
<apex:form>
put remaining code
<apex:form>
<apex:form >
<apex:outputpanel id="selobjren">
<apex:outputpanel rendered="{!secondsecren == true}">
<apex:inputFile value="{!BlobFile}" filename="{!RecordsInTheFile}" accept=".csv" />
<apex:commandButton value="Map Values" action="{!objrelatedfields}" reRender="selfieldren"/>
</apex:outputpanel>
</apex:outputpanel>
</apex:form>
Thanks,
Raghavendra Reddy.D
Note: Unfortunately, nesting an apex:form inside another apex:form doesn't compile.
Why you don't use apex:actionRegion?
I had similar problem. Then I wrapped everything that I need to have an rerender attribute on with apex:actionRegion and I'm fine.