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
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/>
     <script>
     
     function ValidationJs(){
     var val= document.getElementById("pg:fm:filename").value
     
      if(val == ''){
      
          alert('Please enter filename');
       }else{
       
         SavefileActfunc();
        }
     
     }
     
     </script>

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

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

Controller:
public class Testcntrl {

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



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.

Franklin.
 
AnudeepAnudeep (Salesforce Developers) 
Hi Franklin, 

I recommend checking this post where a similar issue is discussed

Let me know if this helps