• Soumya sri Reddy
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 0
    Replies
hi  developers, how u handle the above error, as it is says not to use the rerender and oncomplete attribute while use of apex:inputfile

Note: if i remove the rerender and oncomplete attribute it was working fine as per requirement ..

i need to use , oncomplete and rerender attribute how to resolve this issue ,can any one help in resolving this issue

 
public with sharing class renderFile {
    public transient Blob fileBody { get; set; }
    public String contentType { get; set; }
    public String fileName { get; set; }
    

    public void save() {
         system.debug(fileName);
         system.debug(fileBody);
         system.debug(contentType);
        
    }
    
}

V.f page:
 
<apex:page controller="renderFile" id="pg">
    <apex:form id="form">
       
                        Name of Employee:<apex:inputtext id="name"/><br/><br/>
                        Emplpoyee Image:<apex:inputFile contentType="{!contentType}" fileName="{!fileName}" value="{!fileBody}" /><br/>
                        
                        <apex:commandButton value="Save"    onclick="validationjs(); return false;"/>  <!--action="{!save}"-->
                         <apex:ActionFunction name="saveActfun"  action="{!save}" oncomplete="savedalert();" rerender="name"/>
                        <script>
                           function validationjs(){
                           var name = document.getElementById("pg:form:name").value;
                           if(name ==''){
                             alert('name is requried');
                              }else{
                              saveActfun();
                              }
                          }
                         
                         function savedalert(){
                          alert('Details saved sucessfully');
                          
                          }
                         </script>
                      
    </apex:form>
</apex:page>

if i remove the rerender attirbute and oncomplete it was working fine, but need to implement the rerener and oncomplete functionality ..

Thanks and regards
soumya Reddy
i can add the values with copy functionaliyt, but can any one help me in the remove all and remove selected functionality in salesforce with the below code .
v.f.page:
<apex:page controller="test11cntrl">
   <apex:form >
   
            <apex:selectList id="Avilblecities" multiselect="true" tabindex="1"  value="{!copyselectedvallist}" >  
                     <apex:selectOptions value="{!NotselectedOptions}"/>
                  </apex:selectList>
                  <br/>
             <apex:commandButton value="copyselected" action="{!copyselected}"  rerender="selrdnr"/> <br/>
                 
                 <apex:commandButton value="Removeslected" action="{!removeselected}"  rerender="selrdnr"/><br/>
                 <apex:commandButton value="Removeall" action="{!removeall}"  rerender="selrdnr"/><br/>
                  <apex:outputPanel id="selrdnr">
                  <apex:selectList id="Selectedcites" multiselect="true" tabindex="1"  value="{!copyselectedvallist2}" >  
                          <apex:selectOptions value="{!selectedOptions}"/>
                  </apex:selectList>
                  </apex:outputPanel>
   </apex:form>
</apex:page>

Apex class:
public class test11cntrl {

  public list<string> copyselectedvallist{get;set;}
  public list<selectoption>NotselectedOptions{get;set;}
  public list<string> copyselectedvallist2{get;set;}
  public set<selectoption>selectedOptions{get;set;}
  
  public test11cntrl(){
    copyselectedvallist= new list<string>();
    NotselectedOptions= new list<selectoption>();
    copyselectedvallist2= new list<string>();
    selectedOptions= new set<selectoption>();
     citylist = new list<string>();
     citydetails();
   }
   
   public list<string> citylist{get;set;}
   public void citydetails(){
        citylist.add('mumbai'); 
        citylist.add('maharastra');
        citylist.add('uttarpradesh');
       
       for(string s:citylist){
        NotselectedOptions.add(new SelectOption(s,s));
        }
   }
    
   public void copyselected(){
       for(string s: copyselectedvallist){
           Selectedoptions.add(new SelectOption(s,s));
         }
   }
    
    
    public void removeselected(){
    //remove the selected cites
    
    }
    
    public void removeall(){
     //remove all cities
    }
   
}

Can anyone ,help to handle the removeall frm seleced cities and remove only selectedcites functionality

thanks and regards
soumya sree

 
hi, my code is working, fine. to check duplicates used contains method , 
if  exists iam getting true value, but i need to get the false value also if not in list , how can  i solve this issue ..

User-added image

need to add : false ,for the 'b' as it wont exists
Apex class:
public class test3{
 public list<string>listSelectedNames{get;set;}
 public list<Wrapperclass>wraplist{get;set;}
 public list<boolean> Selectedbooleanlist{get;set;}
 public list<string>duplicatevalues{get;set;}
  
  public test3(){
 listSelectedNames = new list<string>();
 Selectedbooleanlist= new list<boolean>();
 duplicatevalues= new list<string>{'a','c'}; //duplicated to filter
 wraplist = new list<Wrapperclass>();
   Wrapperclass   wf = new Wrapperclass();
                  wf.selected=false;
                  wf.name ='a';
                 
    Wrapperclass   wf1 = new Wrapperclass();
                  wf1.selected=false;
                  wf1.name ='b';
                                  
   Wrapperclass   wf2 = new Wrapperclass();
                  wf2.selected=false;
                  wf2.name ='c';
                
          wraplist.add(wf);
          wraplist.add(wf1);
           wraplist.add(wf2);
        
 }
 
 
   public void duplicatecheck(){
   listSelectedNames.clear();
   Selectedbooleanlist.clear();
    for(wrapperclass wrap: wraplist){
      if(wrap.selected == true){
    listSelectedNames.add(wrap.name);
        }  
      }
     
     //to check duplicate
     for(String s1 : duplicatevalues){
      if(listSelectedNames.contains(s1)){
        boolean selected =  true;
        Selectedbooleanlist.add(selected);
         
   
      //add logic 
       }
    } 
        
        }
 //wrapper classs
    public class Wrapperclass{
       public boolean selected{get;set;}
       public string Name{get;set;}
    }
  
  
}


Visualforce Page:

 
<apex:page controller="test3">
   <apex:form >
   <apex:pageBlock >
      <apex:pageblockTable value="{!wraplist}"  var="a">
       <apex:column ><apex:inputCheckbox value="{!a.selected}"/>{!a.name}</apex:column>
       </apex:pageblockTable>
    <apex:commandButton value="OrderSelected"  reRender="one,two" action="{!duplicatecheck}"/>
      <apex:outputLabel id="one">{!listSelectedNames}</apex:outputLabel>
       <apex:outputLabel id="two">{!Selectedbooleanlist}</apex:outputLabel>
    </apex:pageBlock>
   </apex:form>
</apex:page>
//as it contains iam getting true, but to get false also if it dnt contains in the list of boolean
please help in this issue iam stucked
advance thanks
soumya yerava .