• Deepikareddy
  • NEWBIE
  • 240 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 55
    Questions
  • 43
    Replies
list<string> Productdetails = new list<string>();

empdetails.add('sony');
empdetails.add('samsung');
empdetails.add('Voltas');
empdetails.add('bluestar');


list<string> Itemdetails = new list<string>();

empdetails.add('LG');
empdetails.add('samsung');
empdetails.add('Butterfly');


 need to check it if the duplicate is ther, need to show a pop up as already exists,with bootstrap popup model

thanks 
deepika 
This file is sample  tab Elimated Text file .. how to read this file and add to the List and render  in visualforce page in Salesforce ..!
User-added image Apex Class:
public class Textfileimport{

 public blob Selectedfile{get;set;}
 public list<Studentdetails> Lststudentdetails{get;set;}
 
public Textfileimport(){
Lststudentdetails= new list<Studentdetails>();
}

public void add(){

}
 //wrapperclass
 public class Studentdetails{
 public string studentname{get;set;}
 public string studentId{get;set;}
 public integer studentyear{get;set;}
  }
 
}

visualforce page:
<apex:page Controller="Textfileimport"  >
    <apex:messages />
    <apex:form id="theForm">
  
     <apex:inputFile value="{!Selectedfile}"  id="testhide" />
     
      <apex:commandButton value="ImportValues" action="{!add}"/>
      
      <apex:pageBlock >
      
      <apex:pageblockTable value="{!Lststudentdetails}" var="a" >
       <apex:column headerValue="Name">{!a.studentname} </apex:column>
         <apex:column headerValue="Id" >{!a.studentId}</apex:column>
         <apex:column headerValue="Year">{!a.studentyear}</apex:column>
       
       </apex:pageblockTable>
      </apex:pageBlock>
       
       
      
     </apex:form>
</apex:page>


how to add to list and display in the visualforce page ....!

​​​​​​​Please share any related links it might be help full thank you...!
 

1)contentType="text/plain/#Test.txt".
2)Dataloder 

 Question:
Do we have any sample  method or predefined Method to download a  list of values in the form of Text file or Csv file.Except the Content type or Dataloader

Ex: list<account> acc = [select id and name form account limit 5];

//how to download the id and account name in text file and Csv file with out using content type and dataloader .. 

Thanks 
Deepika

  
hi , created a list and going to add the record , but the 1st record is not getting added, only the second record is geting add, my i knw the reason behind that thanks ..
<apex:page controller="accountinsert" >
 
 
  <apex:form >
   
   <apex:pageblock >
    <apex:pageblockSection >
     
     <apex:inputField value="{!acc.name}"/>
    <apex:inputField value="{!acc.phone}"/>
    <apex:inputField value="{!acc.Rating}"/>
    <apex:inputField value="{!acc.Industry}"/>
    
    </apex:pageblockSection>
   
    <apex:pageblockButtons location="top">
    
    <apex:commandButton Value="Submit" action="{!addtolist}"  />
    
     <apex:commandButton Value="Clear" action="{!Clear}"  />
    </apex:pageblockButtons>
   
   <apex:pageblockSection columns="1" Rendered="{!lstaccount.size>0}"  >
   
     <apex:pageblockTable value="{!lstaccount}" var="a"  > 
    
     <apex:column headerValue="Name">{!a.name}</apex:column>
     
     <apex:column headerValue="Phone">{!a.Phone}</apex:column>
     
     <apex:column headerValue="Rating">{!a.Rating}</apex:column>
     
     
     <apex:column headerValue="industry">{!a.industry}</apex:column>
    </apex:pageblockTable>
    
    
   </apex:pageblockSection>
  
   
   
   
   
   </apex:pageblock>
  
  </apex:form>
</apex:page>

Controller:
 
public class accountinsert {

 public list<account> lstaccount{get;set;}
 
  public account acc{get;set;}
  
  
   public accountinsert(){
   
    lstaccount= new list<account>();
     //acc = new account();
  
   }
   
    public void addtolist(){
    
     acc = new account();
      
    lstaccount.add(acc);
    
    
    }
    
    public void Clear(){
    
    lstaccount.clear();
    
    }
}

my i know the reason, why iam not getting add, the 1st record, and other getting added,,

Thanks 
Deepika


 
File is getting dowload..!
1)Need to print the records in the Row by Row..as ALL RECOREDS  is printing in a single row..
 
public class TesttabEliminated{

public list<account> lstaccount{get;set;}
public TesttabEliminated(){

 lstaccount = new list<account>();
 lstaccount =[select id, name from account limit 5];
 
} 
 
}
V.F:
<apex:page controller="TesttabEliminated"   contentType="text/plain/#test.txt">
   <apex:repeat value="{!lstaccount}"  var="a">
 {!a.id}    {!a.name}
 </apex:repeat>
  
</apex:page>

ANY SUGGESTIONS TO PRINT IN THE NEXT ROW WITH THE TABELIMINATED FORMAT.. 

THANKS,
dEEPIKA

 
 i had wrote the code but it is not getting download in the tab elimated format..  in need to change the format in controller side or client side.
public class test3 {

public list<CustomerWrapper> lstcustomerwrapper{get;set;}

public test3(){

lstcustomerwrapper = new list<CustomerWrapper>();
 
}
 
public PageReference Exportfileastextformat(){

string  Samplejsonformat = '{"$id":"1","data":[{"applicantname":"Raju","LoanAmount":"350000","address":null,"city":null,"state":"  "},{"applicantname":"Ramesh","LoanAmount":"9600000","address":"E-city banglore","city":"bng","state":"TG"},{"applicantname":"Raghu","LoanAmount":"5690000","address":"mountroad che","city":"che","state":"tn"}]}';

  Map<String, Object> maptest =   (Map<String, Object>) JSON.deserializeUntyped(Samplejsonformat );
  system.debug('mapped and deserialized data is::'+maptest);
          
       Object ob = (Object)maptest.get('data');    
       system.debug('get data is::'+ob);
       
      String srlze  = System.JSON.serialize(ob); 
      system.debug('again deserailized is ::'+srlze );
 
 lstcustomerwrapper=(list<CustomerWrapper>)system.json.deserialize(srlze,list<CustomerWrapper>.class);
     system.debug('deserilize using the wrapperclass::::::'+lstcustomerwrapper[0].applicantname);
      system.debug('deserilize using the wrapperclass::::::'+lstcustomerwrapper[0].LoanAmount);
  
PageReference pg = new pageReference('/apex/test4');
 return pg;
  
}


 public class CustomerWrapper{
 
  public string applicantname{get;set;}
  public string LoanAmount{get;set;}
  public string address{get;set;}
  public string city{get;set;}
   public string state{get;set;}
 
 }
 
}

v.f page:1
 
<apex:page controller="test3">
  
  <apex:form >
  
      <apex:commandButton Value="ExportasTextfile" action="{!Exportfileastextformat}"/>
  
  </apex:form>
</apex:page>

v.f page:test4
<apex:page controller="test3" contentType="text/plain/#test.txt" > <!--contentType="text/plain/#test.txt"--->

 <apex:repeat value="{!lstcustomerwrapper}"  var="a">
 
 {!a.applicantname} {!a.LoanAmount} {!a.address} {!a.city} {!a.state}
 
 </apex:repeat>
</apex:page>



i need to get in the format: need to add the next line when the recrd is compled looped.

Raju   350000
Ramesh  9600000  E-city banglore bng  TG
Raghu     5690000  mountroad che  che  tn


But getting the format is : without breaking and without tabElimination.

Raju   350000 Ramesh  9600000  E-city banglore bng  TG Raghu     5690000  mountroad che  che  tn

note: iam not getting the TabEliminated Functionality...! any useful links..!

thanks
Deepika 
 
public class notes2 {

 public list<string> SelectedValue{get;set;}
 
 public list<selectoption> Alloptions{get;set;}
 
 public list<selectoption> Selectedoptions{get;set;}
 
  
   public notes2(){
   getnames(); 
    }
 
  public void getnames(){
  Alloptions= new list<selectoption>();
  selectoption s1 = new selectoption('Ban' ,'Banglore');
  selectoption s2 = new selectoption('Hyd' ,'Hyderbad');
  selectoption s3 = new selectoption('Che' ,'Chennai');
  selectoption s4 = new selectoption('Ap' ,'Andhrapradesh');
  Alloptions.add(s1);
  Alloptions.add(s2);
  Alloptions.add(s3);
  Alloptions.add(s4);
  }
  
   public void Removelist(){
   
    system.debug('the selected values are::'+ selectedvalue);
    
    for(integer i=0;i<selectedvalue.Size();i++){
    
    system.debug(selectedvalue[i]);
   
   /*
       if(RightSelectedValues[i].getValue() == RightSelectedValues){
              //Selectedfileds.remove(i);
             }
    
   */
   
    
    }
   
   
     
   }
}

Visualforce page:
<apex:page controller="notes2" >
  <apex:form id="fm">
  
   <apex:outputPanel id="test1" >
    <apex:selectList value="{!SelectedValue}"  id="slctedval" multiselect="true" size="5">
      <apex:selectOptions value="{!Alloptions}"/>
     </apex:selectList>
     
     
     <br/>
      
     &nbsp; &nbsp;
     <apex:commandButton value="Removielist"  action="{!Removelist}"/>
       &nbsp; &nbsp;
      
       
       <br/><br/>
      
     
       
        
         
       
  </apex:outputPanel>
   
   </apex:form>
</apex:page>

getting an  error: unable to find the Getvalue methods.
Please provide  a solution for this. 
Thanks 
Deepika Reddy
public class notes2 {

 public string SelectedValue{get;set;}
 
 public list<selectoption> Alloptions{get;set;}
 
 public list<selectoption> Selectedoptions{get;set;}
 
  
   public notes2(){
   getnames(); 
    }
 
  public void getnames(){
  Alloptions= new list<selectoption>();
  
  selectoption s1 = new selectoption('Ban' ,'Banglore');
  selectoption s2 = new selectoption('Hyd' ,'Hyderbad');
  selectoption s3 = new selectoption('Che' ,'Chennai');
  selectoption s4 = new selectoption('Ap' ,'Andhrapradesh');
  Alloptions.add(s1);
  Alloptions.add(s2);
  Alloptions.add(s3);
  Alloptions.add(s4);
  }
  
   public void addtolist(){
   
    system.debug('the selected values are::'+ selectedvalue);
    
   }
}

Visualforcepage:
 
<apex:page controller="notes2" >
  <apex:form id="fm">
  
  
   
   <apex:outputPanel id="test1" >
    <apex:selectList value="{!SelectedValue}"  id="slctedval" multiselect="true" size="5">
      <apex:selectOptions value="{!Alloptions}"/>
     </apex:selectList>
     
     
      
     &nbsp; &nbsp;
     <apex:commandButton value="Addtolist" />
       &nbsp; &nbsp;
       <apex:selectList id="Hydlist" multiselect="true" size="5" style="width:100px;" >
      <apex:selectOptions value="{!Selectedoptions}"/>
       </apex:selectList>
       
       <br/><br/>
      
     
       
        
         
       
  </apex:outputPanel>
   
   </apex:form>
</apex:page>

 
how to add the selected values of onepicklist to other picklist of multislect, please provide usefull links
note: Duplicates cannot be added further.
User-added image

thank you.. !
Deepika chowdary
 
I had created a prgrame in such a way that,if i click on the add, the data entered in the input filed will bind to the list.. 
note: the code is working fine, but the issue is for the first record is not getting added, may i know why ?? onclicking on next time the record is getting ading.
 
apex code as follows:

 
public class accountexample {
 
  
  
  public account ac{get;set;}

   public list<account> lstacc{get;set;}
   
    public  accountexample(){
    lstacc= new list<account>();
    ac = new account();
    //addtolist();
     }
     
      public void addtolist(){
       ac = new account();
       lstacc.add(ac);
       system.debug(lstacc);
      }
     
      
  
}

Visuaforce page:
 
<apex:page controller="accountexample">
  <apex:form >
   <apex:pageblock >
     <apex:pageblockSection >
      
       <apex:inputField value="{!ac.name}"/>
       
       <apex:inputField value="{!ac.phone}"/>
       
       <apex:inputField value="{!ac.rating}"/>
       
     </apex:pageblockSection>
     
      <apex:pageblockButtons >
        <apex:commandButton value="add" action="{!addtolist}" reRender="t" />
      
      </apex:pageblockButtons>
   </apex:pageblock>
   
   
    <apex:pageblock >
    <apex:pageBlockTable value="{!lstacc}" var="a" id="t">
        <apex:column headerValue="Name">{!a.name}</apex:column>
        <apex:column headerValue="Phone">{!a.phone}</apex:column>
         <apex:column headerValue="Rating">{!a.rating}</apex:column>
      </apex:pageBlockTable>
    
    </apex:pageblock>
   </apex:form>
</apex:page>

note: for the 1st time the record is not getting added,but for the second and thrid and soon on the data is getting added.

Thanks
Deepika, 
Do anyone have idea to pass the Selectlist value to the Javascript in Salesforce using Document.Element.id .

i need to get the selected value as an alert ;;
 Please let me know how can i get the values , using the javascript Element.id Only

Or provide useful links will go through it .. 
<apex:page id="pg" >
  
 <apex:form id="frm">
 
 <script>
      
      function  getvalue(){
        alert("hi");
       var selectedvalue =document.getElementById("pg:frm:otptpanel:selectlist").value; 
       alert(selectedvalue);
      }
     
      </script>
  <apex:outputPanel id="otptpanel" >
   
    <apex:selectList id="selectedval" size="1" onchange="getvalue()"> 
   <apex:selectOption itemLabel="Hyderbad" itemValue="Hyd"/>
     <apex:selectOption itemLabel="Banglore" itemValue="Ban"/> 
      <apex:selectOption itemLabel="Chennai" itemValue="Che"/>  
    
   </apex:selectList>
  
      </apex:outputPanel>
  
   
 
 
 </apex:form>
 
</apex:page>

using the Javascript Element only .. 
Thanks
Deepika
 
Hi iam getting the data form the external system, need to Export the data as the Textfile and Excel file onclicking of the Command button.
For Example:
suppose i have two comandbutton, of save as text file, and other save as excelfile, files should be save depending upon respective button.

ANy Solutions and usefull links or related blogs  are very much appreciated. 
thanks
Deepika 
 
Learning of Datascience with artifical intelligence and Machine Learning, will add advance to salesforce?? 
or it is seperate  domain, which is not related to salesforce...
As i have seen the Enstien and Artifical intelligence in salesforce ..! 
Thanks 
Deepika
Note: as per my code all the rows are getting rendered, on clicking of the Edit button,but the requirement is ::
1)on  click of the Edit button, that particular row should have to change to input , how it can be acheived.
Controller : 
public class testingclass {

public string xmlstring{get;set;}
 public string testingval{get;set;}
 public List<string> lsttestingval{get;set;}
 public boolean  indexSel{get;set;}
 public boolean anyBooleanValue{get;set;}
 
 public testingclass(){
  anyBooleanValue =true;
  lsttestingval = new list<string>();
  lsttestingval.add('Red');
    lsttestingval.add('Blue');
    lsttestingval.add('Yellow');
    
  }
  
   public void edit(){
   
   anyBooleanValue =False;
   }
   
   public void delet(){
   
  system.debug(lsttestingval.size());
    }
  
}
V.f page:
<apex:page controller="testingclass">
<apex:form >
    <table style="width:100%">
  <tr>
    <th>name</th>
    <th>Edit</th>
    <th>Delete</th>
  </tr>
<apex:variable var="cnt" value="{!0}" /> 
 <apex:repeat var="a" value="{!lsttestingval}"> 
 <tr>
     <td>
      <apex:outputPanel rendered="{!anyBooleanValue}" >{!a}</apex:outputPanel>
      <apex:outputPanel rendered="{!!anyBooleanValue}" ><apex:inputText /></apex:outputPanel>
      <!--<apex:outputPanel rendered="{!!anyBooleanValue && cnt == !indexSel}"><apex:inputText value="{!a}"/></apex:outputPanel> --->
     </td>
     <td><apex:commandbutton action="{!Edit}" value="Edit" /></td>
      <td><apex:commandbutton action="{!delet}" value="Delete" /></td>
      </tr>
      <apex:variable var="cnt" value="{!cnt+1}"/>
     </apex:repeat>
 
</table>
   
   </apex:form>
</apex:page>



Before click on edit buttonAfter clicking on the Edit button//please provide me solution that only that particular rwo should have to render.. thnks in advance
1)Onclick on the Edit all the rows are getting changed to input, jst need to change the row to Editmode on particular selected row any solution please let me know thanks ...

 
<apex:page controller="testingclass">
<apex:form >
    <table style="width:100%">
  <tr>
    <th>name</th>
    <th>Edit</th>
    <th>Delete</th>
    
  </tr>
  <apex:variable var="cnt" value="{!0}" /> 
 <apex:repeat var="a" value="{!lsttestingval}"> 
     <tr>
     <td>
      <apex:outputPanel rendered="{!anyBooleanValue}" >{!a}</apex:outputPanel>
       <apex:outputPanel rendered="{!!anyBooleanValue}" ><apex:inputText /></apex:outputPanel>
     </td>
     <td><apex:commandbutton action="{!Edit}" value="Edit" /></td>
      <td><apex:commandbutton action="{!delet}" value="Delete" /></td>
      </tr>
      <apex:variable var="cnt" value="{!cnt+1}"/>
     </apex:repeat>
     
 
 
</table>
   
   </apex:form>
</apex:page>

Controller:
public class testingclass {

public string xmlstring{get;set;}
 public string testingval{get;set;}
 public List<string> lsttestingval{get;set;}
 public boolean  indexSel{get;set;}
 public boolean anyBooleanValue{get;set;}
 
 public testingclass(){
  anyBooleanValue =true;
  lsttestingval = new list<string>();
  
   lsttestingval.add('Red');
    lsttestingval.add('Blue');
    lsttestingval.add('Yellow');
    
  }
  
   public void edit(){
   
   anyBooleanValue =False;
   }
   
   public void delet(){
   
  system.debug(lsttestingval.size());
    }
  
}

//please help to solve this issue.. 

Note: on Edition Only particular row should have to Edit..
Thanks
Deepika subramanyam
 <apex:pageblock id="pb1">
            <apex:pageblockSection id="pbs1">
                <apex:inputCheckbox id="checkbox1" label="Check Me" onclick="getCheckBoxValue();"></apex:inputCheckbox>
                <apex:inputtext id="textbox1" label="Name" onchange="gettexBoxValue();"/>
            </apex:pageblockSection>
        </apex:pageblock>
    
    <script language="javascript">
        function getCheckBoxValue()
        {
        
           
           alert(document.getElementById('{!$Component.frm1.pb1.pbs1.checkbox1}').checked);  
        }
        
         function gettexBoxValue()
        {
          
           var a=document.getElementById('{!$Component.frm1.pb1.pbs1.textbox1}');
            alert(a);  
        }
       //if iam using this iam getting.  
        function CopySubject() {
      var CaseSub= $('[id$=textbox1]').val();
       alert(CaseSub); 
       }
    </script>
Hi..by using the Restapi, got the data form the External system and deserilaized the data and stored in the string.now i have
two command buttons  Export as textfile, and Export as Csv file. 
 1)when i click on the txt button need to save as txt.file.
2)when click on the Csv button need to save as Csv.file
Any suggestions to save the data on two command buttons in salesforce..How can i procced.
Thanks in advance 
Deepika...!
Hi..Onclicking of the data, iam getting the values of the particular selected data, but while rendering, it is not getting render do any one provide the solution for this.. thanks
Visualforce page:
 
<apex:page controller="testclass7" >
  <apex:form >
   <apex:actionFunction name="passValueToController" action="{!testvalues}" reRender="frm">
            <apex:param name="selectedValue" value="selectedValue" assignTo="{!selectedValue}"></apex:param>
        </apex:actionFunction>
  <apex:repeat value="{!wrapclasslist}" var="a" >
 
        <li style="padding:5px;cursor:pointer;" onclick="passValueToController('{!a.value}'); return false;" > 
                {!a.stateName}
            </li>
        </apex:repeat>
  
   
   <apex:outputPanel id="frm">
   
     statename is: <apex:inputText value="{!wrpclas.stateName}"/> <br/><br/>
   value is: <apex:inputText value="{!wrpclas.value}"/> <br/><br/>
    active is: <apex:inputText value="{!wrpclas.active}"/> <br/><br/>
   
    </apex:outputPanel>
    
  
  </apex:form>
</apex:page>

Apex class:
public class testclass7 {
 public list<wrapperclass> wrapclasslist{get;set;}
 public list<wrapperclass> wrapclassaddedlist {get;set;}
 
  public wrapperclass wrpclas{get;set;}
  public string selectedValue{get;set;}
  
 public testclass7 (){
 wrapclasslist = new list<wrapperclass>();
 wrapclassaddedlist = new list<wrapperclass>();
     string  teststring= ' { "sucess":1,"data": [ {"stateName": "Andrapradesh",  "value": "apx" ,"active":"yes"}, { "stateName": "Telangana",  "value":"tsx","active":"processing-no"}, {"stateName": "Banglore",  "value": "bngx","active":"processing-yes"} , {"stateName": "Maharastra",  "value":"mhx" , "active":"no" }  ] } ';
     Map<String, Object> maptest =   (Map<String, Object>) JSON.deserializeUntyped(teststring);
     system.debug('Afterdeserilizing the values are:'+maptest);
     Object ob = (Object)maptest.get('data');
     system.debug('Afterdeserilizing get the data values are:'+ob);
     String srlze   = System.JSON.serialize(ob);
     system.debug('done serilization of the values:'+srlze);
     wrapclasslist = (list<wrapperclass>)System.JSON.deserialize(srlze,list<wrapperclass>.class);
     system.debug('After binding to the wrapper class the values is:'+wrapclasslist); 
 }
 
  /*
  public void testvalues(){
    system.debug('for Datatable functionality:'+ selectedValue);
    
    for(wrapperclass e: wrapclasslist){
      if(e.value==selectedValue){
      wrapclassaddedlist.add(e);
      
         }
     } 
     */
     
     
    public void testvalues(){
    system.debug('for Datatable functionality:'+ selectedValue);
    for(wrapperclass e: wrapclasslist){
      if(e.value==selectedValue){
      // wrpclas.add(e);
      system.debug(e);
     
      }
     }
  
  }
   public class wrapperclass{
   public string stateName{get;set;}
   public string value{get;set;}
   public string active{get;set;}
    
   }
}

how to display the data Onselecting the data.. 

User-added image
 Please provide your suggestions to render it dependig upon the selection .,
thanks
​​​​​​​Deepika 
map<string,string> custmap = new map<string,stirng>();(declared and initialised in the constructor)
 Example1:in Debug window the custmap values are :
 {Andrapradesh=5.0, Karnataka=3.0, Maharastra=2.5, Telangana=4.0}

//How to print the keyset and values :

 for(list<wrapper> s: custmap){
       system.debug(s.keyset());
        system.debug(s.Values());
     
      }

//wrapperclass 
public class wrapper{
public string statename;
public string rating;
}

Thanks
Deepika
Hi .. Developers  How to pass values form One selectlist to other selectlist in salesforce and render values it with onchange event.. 

 
public class test15{
    public  string selectedOption{get;set;} 
    public  string selectedOption2{get;set;}
    public Wrapper Wrapper1{get;set;}
    public list<wrapper> lstWrapper1{get;set;}
    public list<wrapper>addedlist{get;set;} 
      public  string statename{get;set;} 
       public  string capitalname{get;set;} 
        public  string rating{get;set;}   
    public  test15(){
    addedlist = new list<wrapper>();
        lstWrapper1 = new list<wrapper>();   
        string  jsonexample1 =  ' { "overalldata": [ {"stateName": "Andrapradesh",  "rating": "5.0" , "active": "yes" ,"Capital":"Amaravathi"}, { "stateName": "Telangana",  "rating": "4.0" ,"active": "no","Capital":"Hyderabad" }, {"stateName": "Karnataka",  "rating": "5.0" ,"active": "no","Capital":"Banglore"} , {"stateName": "Maharastra",  "rating": "4.5" ,"active": "no","Capital":"Mumbai"}] } ';
  Map<String, Object> mapobj1 = (Map<String, Object>)JSON.deserializeUntyped(jsonexample1);
        system.debug('the Mapped and deserialized values are:'+ mapobj1); 
        Object objj1 = (object)mapobj1.get('overalldata');
        system.debug('the data value is :::'+objj1);
        string  SerilizeEmpdata1 = system.json.serialize(objj1);
        system.debug(SerilizeEmpdata1);
        lstWrapper1 =(list<wrapper>)system.json.deserialize(SerilizeEmpdata1,list<wrapper>.class);
        system.debug(lstWrapper1); 
    }  
    public List<SelectOption> getItems() {
        List<SelectOption> options = new List<SelectOption>();
        options.add(new SelectOption('none','--select One--'));
        For(Wrapper lw :lstWrapper1)
            options.add(new SelectOption(lw.stateName,lw.stateName));
        return options;
   }
   
   public string MYVAR{get;set;}
   public void Taxtableonclick(){
   system.debug('the selected value is:::'+MYVAR);
   }
  public Wrapper wpr{get;set;}
    
  public void add(){
  addedlist.add(wpr);
   } 
   
   
   
   
  public class Wrapper{
        public string  stateName{get;set;}
        public string  rating{get;set;}
        public string  active{get;set;}
        public string  Capital{get;set;}
  }
  
}

Visualforc page:
<apex:page controller="test15"> 
<apex:form >  
   <apex:actionFunction name="Taxtableonclick" action="{!Taxtableonclick}" rerender="myPanel">
              <apex:param value="MYVAR" name="MYVAR" assignto="{!MYVAR}"/>
          </apex:actionfunction>    
<apex:selectList value="{!SelectedOption}"  size="1" multiselect="false" onchange="Taxtableonclick(this.value);">
            <apex:selectOptions value="{!items}"/>
            </apex:selectList>
<apex:commandButton value="Add+" reRender="t"  action="{!add}"/>
      <br/>
 <apex:pageBlock >
 
 
  
 
 <apex:selectList id="t" >
  
   <apex:selectOptions value="{!addedlist}"/>
   
   <apex:actionSupport event="onchange"  reRender="test"/>
  
 </apex:selectList>
 
  <apex:outputPanel id="test">
   you have selected state: {!statename} <br/>
    its capital is: {!capitalname} <br/>
    its rating is:{!rating}
  </apex:outputPanel>
  
   
 <apex:commandButton value="Save" /> 
   
 </apex:pageBlock>
</apex:form>
</apex:page>
thanks 
Deepika
​​​​​​​
Hi.. i have a requirement, that onclick of the Edit button, that particular values should have to change to input.. 
2.)On deletetion partiucalr value in the list should be delete.. 

In my code total list is going change..!
 
public class testingclass {

public string xmlstring{get;set;}
 public string testingval{get;set;}
 public List<string> lsttestingval{get;set;}

 public boolean anyBooleanValue{get;set;}
 public testingclass(){
  anyBooleanValue =true;
  lsttestingval = new list<string>();
  
   lsttestingval.add('Red');
    lsttestingval.add('Blue');
    lsttestingval.add('Yellow');
    
  }
  
   public void edit(){
   
   anyBooleanValue =False;
   }
   
   public void delet(){
   
  system.debug(lsttestingval.size());
    }
  
}

VisualForce page:
 
<apex:page controller="testingclass">
<apex:form >

   
    <table style="width:100%">
  <tr>
    <th>name</th>
    <th>Edit</th>
    <th>Delete</th>
    
  </tr>
 <apex:repeat var="a" value="{!lsttestingval}"> 
     <tr>
     <td>
      <apex:outputPanel rendered="{!anyBooleanValue}">{!a}</apex:outputPanel>
     <apex:outputPanel rendered="{!!anyBooleanValue}"><apex:inputText value="{!a}" /></apex:outputPanel>
     </td>
     <td><apex:commandbutton action="{!Edit}" value="Edit"/></td>
      <td><apex:commandbutton action="{!delet}" value="Delete" /></td>
      </tr>
     </apex:repeat>
     
 
 
</table>
   
   </apex:form>
</apex:page>
Note: After editing the value should be editied as same .. 
How to achieve this functinality .. by using scripting technology.. 

Thanks
Deepika
list<string> Productdetails = new list<string>();

empdetails.add('sony');
empdetails.add('samsung');
empdetails.add('Voltas');
empdetails.add('bluestar');


list<string> Itemdetails = new list<string>();

empdetails.add('LG');
empdetails.add('samsung');
empdetails.add('Butterfly');


 need to check it if the duplicate is ther, need to show a pop up as already exists,with bootstrap popup model

thanks 
deepika 

1)contentType="text/plain/#Test.txt".
2)Dataloder 

 Question:
Do we have any sample  method or predefined Method to download a  list of values in the form of Text file or Csv file.Except the Content type or Dataloader

Ex: list<account> acc = [select id and name form account limit 5];

//how to download the id and account name in text file and Csv file with out using content type and dataloader .. 

Thanks 
Deepika

  
hi , created a list and going to add the record , but the 1st record is not getting added, only the second record is geting add, my i knw the reason behind that thanks ..
<apex:page controller="accountinsert" >
 
 
  <apex:form >
   
   <apex:pageblock >
    <apex:pageblockSection >
     
     <apex:inputField value="{!acc.name}"/>
    <apex:inputField value="{!acc.phone}"/>
    <apex:inputField value="{!acc.Rating}"/>
    <apex:inputField value="{!acc.Industry}"/>
    
    </apex:pageblockSection>
   
    <apex:pageblockButtons location="top">
    
    <apex:commandButton Value="Submit" action="{!addtolist}"  />
    
     <apex:commandButton Value="Clear" action="{!Clear}"  />
    </apex:pageblockButtons>
   
   <apex:pageblockSection columns="1" Rendered="{!lstaccount.size>0}"  >
   
     <apex:pageblockTable value="{!lstaccount}" var="a"  > 
    
     <apex:column headerValue="Name">{!a.name}</apex:column>
     
     <apex:column headerValue="Phone">{!a.Phone}</apex:column>
     
     <apex:column headerValue="Rating">{!a.Rating}</apex:column>
     
     
     <apex:column headerValue="industry">{!a.industry}</apex:column>
    </apex:pageblockTable>
    
    
   </apex:pageblockSection>
  
   
   
   
   
   </apex:pageblock>
  
  </apex:form>
</apex:page>

Controller:
 
public class accountinsert {

 public list<account> lstaccount{get;set;}
 
  public account acc{get;set;}
  
  
   public accountinsert(){
   
    lstaccount= new list<account>();
     //acc = new account();
  
   }
   
    public void addtolist(){
    
     acc = new account();
      
    lstaccount.add(acc);
    
    
    }
    
    public void Clear(){
    
    lstaccount.clear();
    
    }
}

my i know the reason, why iam not getting add, the 1st record, and other getting added,,

Thanks 
Deepika


 
public class notes2 {

 public string SelectedValue{get;set;}
 
 public list<selectoption> Alloptions{get;set;}
 
 public list<selectoption> Selectedoptions{get;set;}
 
  
   public notes2(){
   getnames(); 
    }
 
  public void getnames(){
  Alloptions= new list<selectoption>();
  
  selectoption s1 = new selectoption('Ban' ,'Banglore');
  selectoption s2 = new selectoption('Hyd' ,'Hyderbad');
  selectoption s3 = new selectoption('Che' ,'Chennai');
  selectoption s4 = new selectoption('Ap' ,'Andhrapradesh');
  Alloptions.add(s1);
  Alloptions.add(s2);
  Alloptions.add(s3);
  Alloptions.add(s4);
  }
  
   public void addtolist(){
   
    system.debug('the selected values are::'+ selectedvalue);
    
   }
}

Visualforcepage:
 
<apex:page controller="notes2" >
  <apex:form id="fm">
  
  
   
   <apex:outputPanel id="test1" >
    <apex:selectList value="{!SelectedValue}"  id="slctedval" multiselect="true" size="5">
      <apex:selectOptions value="{!Alloptions}"/>
     </apex:selectList>
     
     
      
     &nbsp; &nbsp;
     <apex:commandButton value="Addtolist" />
       &nbsp; &nbsp;
       <apex:selectList id="Hydlist" multiselect="true" size="5" style="width:100px;" >
      <apex:selectOptions value="{!Selectedoptions}"/>
       </apex:selectList>
       
       <br/><br/>
      
     
       
        
         
       
  </apex:outputPanel>
   
   </apex:form>
</apex:page>

 
how to add the selected values of onepicklist to other picklist of multislect, please provide usefull links
note: Duplicates cannot be added further.
User-added image

thank you.. !
Deepika chowdary
 
Do anyone have idea to pass the Selectlist value to the Javascript in Salesforce using Document.Element.id .

i need to get the selected value as an alert ;;
 Please let me know how can i get the values , using the javascript Element.id Only

Or provide useful links will go through it .. 
<apex:page id="pg" >
  
 <apex:form id="frm">
 
 <script>
      
      function  getvalue(){
        alert("hi");
       var selectedvalue =document.getElementById("pg:frm:otptpanel:selectlist").value; 
       alert(selectedvalue);
      }
     
      </script>
  <apex:outputPanel id="otptpanel" >
   
    <apex:selectList id="selectedval" size="1" onchange="getvalue()"> 
   <apex:selectOption itemLabel="Hyderbad" itemValue="Hyd"/>
     <apex:selectOption itemLabel="Banglore" itemValue="Ban"/> 
      <apex:selectOption itemLabel="Chennai" itemValue="Che"/>  
    
   </apex:selectList>
  
      </apex:outputPanel>
  
   
 
 
 </apex:form>
 
</apex:page>

using the Javascript Element only .. 
Thanks
Deepika
 
Note: as per my code all the rows are getting rendered, on clicking of the Edit button,but the requirement is ::
1)on  click of the Edit button, that particular row should have to change to input , how it can be acheived.
Controller : 
public class testingclass {

public string xmlstring{get;set;}
 public string testingval{get;set;}
 public List<string> lsttestingval{get;set;}
 public boolean  indexSel{get;set;}
 public boolean anyBooleanValue{get;set;}
 
 public testingclass(){
  anyBooleanValue =true;
  lsttestingval = new list<string>();
  lsttestingval.add('Red');
    lsttestingval.add('Blue');
    lsttestingval.add('Yellow');
    
  }
  
   public void edit(){
   
   anyBooleanValue =False;
   }
   
   public void delet(){
   
  system.debug(lsttestingval.size());
    }
  
}
V.f page:
<apex:page controller="testingclass">
<apex:form >
    <table style="width:100%">
  <tr>
    <th>name</th>
    <th>Edit</th>
    <th>Delete</th>
  </tr>
<apex:variable var="cnt" value="{!0}" /> 
 <apex:repeat var="a" value="{!lsttestingval}"> 
 <tr>
     <td>
      <apex:outputPanel rendered="{!anyBooleanValue}" >{!a}</apex:outputPanel>
      <apex:outputPanel rendered="{!!anyBooleanValue}" ><apex:inputText /></apex:outputPanel>
      <!--<apex:outputPanel rendered="{!!anyBooleanValue && cnt == !indexSel}"><apex:inputText value="{!a}"/></apex:outputPanel> --->
     </td>
     <td><apex:commandbutton action="{!Edit}" value="Edit" /></td>
      <td><apex:commandbutton action="{!delet}" value="Delete" /></td>
      </tr>
      <apex:variable var="cnt" value="{!cnt+1}"/>
     </apex:repeat>
 
</table>
   
   </apex:form>
</apex:page>



Before click on edit buttonAfter clicking on the Edit button//please provide me solution that only that particular rwo should have to render.. thnks in advance
Hi..Onclicking of the data, iam getting the values of the particular selected data, but while rendering, it is not getting render do any one provide the solution for this.. thanks
Visualforce page:
 
<apex:page controller="testclass7" >
  <apex:form >
   <apex:actionFunction name="passValueToController" action="{!testvalues}" reRender="frm">
            <apex:param name="selectedValue" value="selectedValue" assignTo="{!selectedValue}"></apex:param>
        </apex:actionFunction>
  <apex:repeat value="{!wrapclasslist}" var="a" >
 
        <li style="padding:5px;cursor:pointer;" onclick="passValueToController('{!a.value}'); return false;" > 
                {!a.stateName}
            </li>
        </apex:repeat>
  
   
   <apex:outputPanel id="frm">
   
     statename is: <apex:inputText value="{!wrpclas.stateName}"/> <br/><br/>
   value is: <apex:inputText value="{!wrpclas.value}"/> <br/><br/>
    active is: <apex:inputText value="{!wrpclas.active}"/> <br/><br/>
   
    </apex:outputPanel>
    
  
  </apex:form>
</apex:page>

Apex class:
public class testclass7 {
 public list<wrapperclass> wrapclasslist{get;set;}
 public list<wrapperclass> wrapclassaddedlist {get;set;}
 
  public wrapperclass wrpclas{get;set;}
  public string selectedValue{get;set;}
  
 public testclass7 (){
 wrapclasslist = new list<wrapperclass>();
 wrapclassaddedlist = new list<wrapperclass>();
     string  teststring= ' { "sucess":1,"data": [ {"stateName": "Andrapradesh",  "value": "apx" ,"active":"yes"}, { "stateName": "Telangana",  "value":"tsx","active":"processing-no"}, {"stateName": "Banglore",  "value": "bngx","active":"processing-yes"} , {"stateName": "Maharastra",  "value":"mhx" , "active":"no" }  ] } ';
     Map<String, Object> maptest =   (Map<String, Object>) JSON.deserializeUntyped(teststring);
     system.debug('Afterdeserilizing the values are:'+maptest);
     Object ob = (Object)maptest.get('data');
     system.debug('Afterdeserilizing get the data values are:'+ob);
     String srlze   = System.JSON.serialize(ob);
     system.debug('done serilization of the values:'+srlze);
     wrapclasslist = (list<wrapperclass>)System.JSON.deserialize(srlze,list<wrapperclass>.class);
     system.debug('After binding to the wrapper class the values is:'+wrapclasslist); 
 }
 
  /*
  public void testvalues(){
    system.debug('for Datatable functionality:'+ selectedValue);
    
    for(wrapperclass e: wrapclasslist){
      if(e.value==selectedValue){
      wrapclassaddedlist.add(e);
      
         }
     } 
     */
     
     
    public void testvalues(){
    system.debug('for Datatable functionality:'+ selectedValue);
    for(wrapperclass e: wrapclasslist){
      if(e.value==selectedValue){
      // wrpclas.add(e);
      system.debug(e);
     
      }
     }
  
  }
   public class wrapperclass{
   public string stateName{get;set;}
   public string value{get;set;}
   public string active{get;set;}
    
   }
}

how to display the data Onselecting the data.. 

User-added image
 Please provide your suggestions to render it dependig upon the selection .,
thanks
​​​​​​​Deepika 
hi..! 

i have a requirement, when i clicks on the edit button, span tag should have to change to the Input tag.. 
and when click on the Delete button, that particular row from list should have to removed form the list .. 
 
public class testingclass {

public string xmlstring{get;set;}
 public string testingval{get;set;}
 public List<string> lsttestingval{get;set;}

 public testingclass(){
 
  lsttestingval = new list<string>();
  
   lsttestingval.add('Red');
    lsttestingval.add('Blue');
    lsttestingval.add('Yellow');
    
  }
  
}

Visualforce page:
<apex:page controller="testingclass">
<apex:form >

   
    <table style="width:100%">
  <tr>
    <th>name</th>
    <th>Edit</th>
    <th>Delete</th>
    
  </tr>
 
    <apex:repeat var="a" value="{!lsttestingval}"> 
     <tr>
     <td><span>{!a}</span><apex:inputText styleClass="display:none"/></td> <td><apex:commandButton value="Edit"/></td><td><apex:commandButton value="Delete"/></td>
      </tr>
     </apex:repeat>
     
 
 
</table>
   
   </apex:form>
</apex:page>

After, editing, in input, the span value should have the same as the Edited value.. 

Thanks in Advance.
Deepika
Apex class:
public class Auraopportunity {

    
    @AuraEnabled
    public static list<opportunity> getdata(){
        
      list<opportunity>lstopp =[select id, name, type, amount from opportunity limit 5];   
       return lstopp; 
    }
}

 Component:
<aura:component controller="Auraopportunity">
    <aura:attribute name ="opportunities" type="list"/>
    
    <aura:iteration items="{!v.opportunities}" var="a">
   
   <h1>{!a.id}</h1>
    </aura:iteration>
    
    <aura:handler name="init" value="{!this}" action="{!c.show}"/>
</aura:component>
Controller
({
	show : function(component, event, helper) {
		alert("Hello");
        
        var abc= component.get("c.getdata");
         console.log("Method is invoked");
        abc.setCallback(this,function(response){
             
          var state = response.getState();
             console.log(state);
            
            if(state === "SUCCESS"){
                
                var result = response.getReturnValue();
                console.log(result);
                alert(result);
                component.set("!v.opportunities",  result);
            }else{
                
                 console.log("Failed");
            }
        });
        $A.enqueueAction(abc);
        
	}
})

iam calling in the application :
 
<aura:application >
    <c:Auraoppiteration/>	
</aura:application>
it is not getting display, may i know  , im getting the timeout error itseems, ..
Thanks
Deepika
V.f page:
<apex:page controller="Passingvaluestocntroller">
<apex:form >

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
  
  $(document).ready(function(){
  
 $("#click").click(function(){
 
 debugger;
   alert("hello");
     var name ="Deepika";
   alert(name);
   var branch="Salesforce";
   alert(branch);
   debugger;
   var test = {"Empname":name,"Empbranch":branch};
   alert(test);
   method1();
  });
  
  });
  </script>

 
  <apex:actionFunction name="method1" action="{!method1()}"/>

<input type="button" value="test" id="click"/>
</apex:form>
</apex:page>

Controller:

 
public class Passingvaluestocntroller {


  public void method1(string name, string branch){
   system.debug('salesforce testing');
   system.debug(name);
   system.debug(branch);
  }
  
  
 
  
}

​​​​​​need to pass the javascript varible to the Apex method in salesforce.. 

Thanks D
Deepika
//Data is getting append to the Html select tag, but not appending to the selectlist tag in saleforce.

Note: To use Repeat functionality only ..!

Visualforce page:
<apex:page controller="test12" >
 
<apex:form >
 
  Salesforce Selectlist:   
    <apex:selectList multiselect="false" size="1">
       <apex:selectOption ></apex:selectOption>
      <apex:repeat value="{!lstWrapper1}" var="a">
      <apex:selectOption itemLabel="{!a.Statename}" itemvalue="{!a.rating}" html-data-capitalname="{!a.capital}"></apex:selectOption>
      </apex:repeat>
    </apex:selectList>
    
    <br/> <br/>
   
   Html Selectlist:
    <select>
 <apex:repeat value="{!lstWrapper1}" var="a">
    <option value="{!a.rating}" data-capitalname="{!a.capital}">{!a.statename}</option>
    
    </apex:repeat>         
         </select>
     
</apex:form>
 
</apex:page>


Apex class:
 
public class test12 {

    
 
   
     
     public  string selectedOption{get;set;} 
     public Wrapper Wrapper1{get;set;}
     public list<wrapper> lstWrapper1{get;set;}
     
  public test12(){
      lstWrapper1 = new list<wrapper>();
      
      
    string  jsonexample1 =  ' { "overalldata": [ {"stateName": "Andrapradesh",  "rating": "5.0" , "active": "yes" ,"Capital":"Amaravathi"}, { "stateName": "Telangana",  "rating": "4.0" ,"active": "no","Capital":"Hyderabad" }, {"stateName": "Karnataka",  "rating": "5.0" ,"active": "no","Capital":"Banglore"} , {"stateName": "Maharastra",  "rating": "4.5" ,"active": "no","Capital":"Mumbai"}] } ';

        Map<String, Object> mapobj1= (Map<String, Object>)JSON.deserializeUntyped(jsonexample1);
        system.debug('the Mapped and deserialized values are:'+ mapobj1); 
        Object objj1 = (object)mapobj1.get('overalldata');
        system.debug('the data value is :::'+objj1);
        string  SerilizeEmpdata1 = system.json.serialize(objj1);
        system.debug(SerilizeEmpdata1);
    lstWrapper1 =(list<wrapper>)system.json.deserialize(SerilizeEmpdata1,list<wrapper>.class);
     system.debug(lstWrapper1);
       
      
  
  
   }
  
      public class Wrapper{
      public string  stateName{get;set;}
      public string  rating{get;set;}
      public string  active{get;set;}
      public string  Capital{get;set;}
      
      }
}

After inspecting: it was binded to the html tag but not salesforce tag..

User-added image 

thanks 
Deepika..!
 

APEXCLASS:

i have got the class and derserilized to the respective Class, now need to append the data to the picklist using the Selectlist  using the Repeat Functionality...!


 

public class test12 {

    
 
     
   
     public  string selectedOption{get;set;} 
     public Wrapper Wrapper1{get;set;}
     public list<wrapper> lstWrapper1{get;set;}
     
  public test12(){
      lstWrapper1 = new list<wrapper>();
    
      
    string  jsonexample1 =  ' { "overalldata": [ {"stateName": "Andrapradesh",  "rating": "5.0" , "active": "yes" ,"Capital":"Amaravathi"}, { "stateName": "Telangana",  "rating": "4.0" ,"active": "no","Capital":"Hyderabad" }, {"stateName": "Karnataka",  "rating": "5.0" ,"active": "no","Capital":"Banglore"} , {"stateName": "Maharastra",  "rating": "4.5" ,"active": "no","Capital":"Mumbai"}] } ';

        Map<String, Object> mapobj1= (Map<String, Object>)JSON.deserializeUntyped(jsonexample1);
        system.debug('the Mapped and deserialized values are:'+ mapobj1); 
        Object objj1 = (object)mapobj1.get('overalldata');
        system.debug('the data value is :::'+objj1);
        string  SerilizeEmpdata1 = system.json.serialize(objj1);
        system.debug(SerilizeEmpdata1);
    lstWrapper1 =(list<wrapper>)system.json.deserialize(SerilizeEmpdata1,list<wrapper>.class);
     system.debug(lstWrapper1);
       
       
    
  
      public class Wrapper{
      public string  stateName{get;set;}
      public string  rating{get;set;}
      public string  active{get;set;}
      public string  Capital{get;set;}
      
      
      
      }
}
 

Need to Append the data using the Repeat functionality to selectoption in salesforce
 

<apex:page controller="test12" >
 
<apex:form >

           
            
    <apex:selectList multiselect="false" size="1">
     <apex:repeat value="{!lstWrapper1}" var="a" >

    <!--showing an error while appending to the select option--->
  </apex:repeat>
     
    </apex:selectList>
    
     
</apex:form>
 
</apex:page>
 


Note:
 <apex:selectoption  itemlabel ="{!lstwrapper.name}"  and itemvalue= "{!lstwrapper.rating}" html-data-capitalname ="{!lstwrapper.capitalname}" />

//how it can be acheived....

Thanks 
Deepika Reddy...

 

public class test5 {

  public list<string> lststatename{get;set;}
  public list<string> lstrating{get;set;}
  
  public list<string> lstactive{get;set;}
  public map<string, string> statemap{get;set;}

public map<string, string> activestatusmap{get;set;}

 public set<string> mapkey{get;set;}
 
    public list<string> mapvalue{get;set;}
 public test5(){
 
 
    string  jsonexample1 =  ' { "overalldata": [ {"stateName": "Andrapradesh",  "rating": "5.0" , "active": "yes" }, { "stateName": "Telangana",  "rating": "4.0" ,"active": "no" }, {"stateName": "Banglore",  "rating": "5.0" ,"active": "no"} , {"stateName": "Maharastra",  "rating": "4.5" ,"active": "no" }  ] } ';

   
     map<string,object>  metadatamap= (map<string,object>)json.deserializeuntyped(jsonexample1); 
     
      list<object>  values1= (list<object>)metadatamap.get('overalldata');
        
        
         lststatename= new list<string>();
         lstrating= new list<string>();
         statemap= new map<String, string>();
         
          for(object parsed : values1){
          map<string,object>  values = (map<string,object>)parsed;
          string statename = string.valueof(values.get('stateName'));
          
          string rating= string.valueof(values.get('rating'));
          
          lststatename.add(statename);
             
          lstrating.add(rating);
             
             statemap.put(statename,rating);
             
             }
            
 }
}
Visual force page:
 
<apex:page controller="test5" >

 <apex:form >
   <apex:repeat value="{!statemap}" var="a">
    <apex:selectList >   
               <apex:selectOptions value="{!a}">{!a}</apex:selectOptions>
         </apex:selectList>
   
   </apex:repeat>
            
                                          
      
 
 </apex:form>
 
</apex:page>

Hi..! can any body bind data to the selectlist with statename as itemlabel and rating  as the itemvalue in visualforce page
.. Thank you..!
Hi.. here iam using the apex:include page functionaliy, one page is included in the another page with common controller..

Vfpage1:
<apex:page controller="testingcontroller">
  <apex:form >
  Entername<apex:inputText value="{!testwrap.name}"/>
  </apex:form>
</apex:page>
Vfpage2: Vfpage1 included in the Vfpage2.
<apex:page controller="testingcontroller" id="pg">
  <apex:include pageName="Vfpage1" id="pge"/>
    <apex:form >
    <apex:commandButton value="test" action="{!test}" reRender="t" />
    <apex:outputLabel id="t">{!message}</apex:outputLabel>
    </apex:form>
</apex:page>

Commoncontroller:
 
public class testingcontroller {

 public string message{get;set;}
 public testwrapper testwrap{get;set;}
 public  testingcontroller(){
 testwrap = new testwrapper();
 }
   public void test(){
    message ='Hi hello'+testwrap.name;
   system.debug('testwrap.name=======>'+testwrap.name);
   }
   
    public class testwrapper{
    
      public string name{get;set;}
      public testwrapper(){
        this.name ='';
        }
    }
}

On clicking on the button the data should have to pass to the Common controller. any solution how it can be achived.. thanks in advance..!