+ Start a Discussion
sfdc franklinsfdc franklin 

how to use the actionregion , while using of the apex input file in salesforce,

Got this error while use of the  apex:input file
apex:inputFile can not be used in conjunction with an action component, apex:commandButton or apex:commandLink that specifies a rerender or oncomplete attribute.

Source code:
<apex:page controller="Testcntrl" id="pg">
   <apex:form id="fm"><br/>
     function ValidationJs(){
     var val= document.getElementById("pg:fm:filename").value
      if(val == ''){
          alert('Please enter filename');

 <apex:actionFunction name="SavefileActfunc"  action="{!savefile}"  rerender="t" />

    Name:<apex:inputText id="filename" />  <br/><br/>
     <apex:inputFile value="{!csvfile}"   accept=".txt"/>
      <apex:commandButton value="Save"  onclick="ValidationJs(); return false;"   />

public class Testcntrl {

  public blob csvfile{get;set;}
  public string Filename{get;set;}
  public void savefile(){

If i remove the ReRender attribute in Actionfuction iam  getting the value as null.

If i keep the Rerender attribute in Actionfunction iam getting , rerender cannot be used in the  while using the apex:inputfile

i have many Inputfiled validations need to implement validations with javascript only..

If the ActionRegion is the Solution, then how to use the Actionregion attribute to get the values,

Thanks and Regards.

AnudeepAnudeep (Salesforce Developers) 
Hi Franklin, 

I recommend checking this post where a similar issue is discussed

Let me know if this helps