• sfdc franklin
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 1
    Replies
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.
 
Got below 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.



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 not 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


Please suggest Your Valuables suggestions to handle it..


Thanks  and Regards
Franklin.


 

how to work with , remove and remove all functionality in the salesforce list collection with below code.
 
public class selectoptiontest {

   public set<string>citylist {get;set;}
    public set<selectoption>NotselectedOptions{get;set;}
     public list<string>selectedvallist{get;set;}
  public selectoptiontest(){
        NotselectedOptions= new set<selectoption>();
        selectedvallist= new list<string>();
        citylist= new set<string>();
        citylist.add('mumbai'); 
        citylist.add('maharastra');
        citylist.add('uttarpradesh');
        citylist.add('mumbai'); 
        getdata();
  }
  
  public void getdata(){
    for(string s:citylist){
        NotselectedOptions.add(new SelectOption(s,s));
        }
  }


  public void removeselected(){
        citylist.removeall(selectedvallist);
   }
   
   public void removeall(){
   selectedvallist.clear();
    for(string s:citylist){
    selectedvallist.add(s);
      }
   citylist.removeall(selectedvallist);
    }

 }



v.f page:

 
<apex:page controller="selectoptiontest" >
   <apex:form >
               
                <apex:outputPanel id="t">
              <apex:selectList id="Avilblecities" multiselect="true" tabindex="1"  value="{!selectedvallist}" >  
                     <apex:selectOptions value="{!NotselectedOptions}"/>
                  </apex:selectList>
                  
                  </apex:outputPanel>
                  
                  
                 <apex:commandButton action="{!removeselected}"  rerender="t"   value="removeselected"/>
                  
                   <apex:commandButton action="{!removeall}"  rerender="t"   value="removeAll"/>
                  
   </apex:form>
</apex:page>

can any one help it with it please.

thanks and regards
franklin.
hi guys, i have one  government  tax editable/fillable  pdf form, uploaded into the static resource and from controller need to bind the values to that particular pdf and download the file ..

Do any one worked in such a way , Need your valuable suggestions to work on ..

Thanks and Regards,
Sfdc Franklin
Got below 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.



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 not 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


Please suggest Your Valuables suggestions to handle it..


Thanks  and Regards
Franklin.