0

I am a new developer staffed on a Salesforce project. I am currently developing a custom app just to become familiar with APEX.

Right now, I have an "Upload" file button that reads a file provided by an InputFile tag in VF. However, I have a table with the current Contact object's user email address and another field that I am populating from the file.

I am running into an issue with rerendering and InputFiles. I have researched all of the answers on this forum and (to my knowledge) none of them seem to eliminate the error, which is the following:

"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 have attempted wrapping my button and InputFile in different ActionRegions, Forms, iframes, with no luck.

I would appreciate if anyone has run into this issue without success from the above methods and if anyone has come across a solution.

0

I tried with with js. it will show and hide on click of button. This might help you to display attachment based on your condition.

<apex:page standardController="Account" extensions="inputFileExtension">
<apex:form >     
    <apex:commandButton onclick="toggle('mytag');return false;" value="Attachment"/>
    <div id="mytag" style="display:none">   
        <apex:inputfile value="{!blobString}"></apex:inputfile>
    </div>                            
</apex:form>
<script>
    function toggle(id) {
        var element =
        document.getElementById(id);
        if(element.style.display == 'none') {
        element.style.display = 'block';                
        }
        else {
        element.style.display = 'none';
        }
    }
</script>
</apex:page>
  • Thank you for the attempt Shravan. I modified your concept logic to my needs but apparently Salesforce does not update an record's field while refreshing a VF page unless I go back to the object itself first. My objective was to import a file, and then populate a record field with that data and display the result on the same VF page. Your answer will be useful in my future development however, thank you! – James McCreary Nov 7 '16 at 20:00

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.