• Deepikareddy
  • NEWBIE
  • 220 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 49
    Questions
  • 40
    Replies
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
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..!
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..!
iam getting an error while addding the data to the Selectlist using the Repeat functionality ..!
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 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);
             
             }
            
 }
}

Visualforce page:
 
<apex:page controller="test5" >

 <apex:form >
   <apex:repeat value="{!statemap}" var="a">
    <apex:selectList  value="{!selectedvalue}">   
               <apex:selectOptions value="{!a}">{!a}</apex:selectOptions>
<apex:actionsupport event="onchange" />
         </apex:selectList>
   
   </apex:repeat>
            
    The selected value is:{!selectedvalue} and rating is:                                       
      
 
 </apex:form>
 
</apex:page>
//to add the label as the statename and its value as the rating.. onchange should ahave to display ..!
 
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..!

 
Hi...! need to generate the salesforce simple json....i had embeded a page in the other page.. and trying to generate the json .. 

Page:1:
<apex:page controller="controllertest1">
  <apex:form >
   Enter Name:<apex:inputText value="{!statedet.stateName}"/>
  </apex:form>
</apex:page>
Page:2  : called page1 in page2
<apex:page controller="controllertest1">
 <apex:include pageName="testpage1"/>
  <br/>
  <apex:form >
   <apex:commandButton value="JSON GENERATOR"  action="{!genereatejson}" reRender="tm" />
  <br/>
   <apex:outputLabel id="tm"> {!jsonstrng}</apex:outputLabel>
  </apex:form>
</apex:page>

Commoncontroller:
public class controllertest1{
   public statedetails statedet{get;set;}
   public string jsonstrng{get;set;}
   public  controllertest1(){
     string  teststring= ' { "sucess":1,"data": {"stateName": "Andrapradesh",  "value": "apx" ,"rating":5 } } ';
     Map<String, Object> maptest =   (Map<String, Object>) JSON.deserializeUntyped(teststring);
     Object ob = (Object)maptest.get('data');
     String srlze  = System.JSON.serialize(ob);
     statedet= (statedetails)System.JSON.deserialize(srlze,statedetails .class);
    }
 public void genereatejson(){
          JSONGenerator gen = JSON.createGenerator(true);
          gen.writeStartObject();
          gen.writeStringField('stateName',statedet.stateName);
          gen.writeEndObject();
          jsonstrng = gen.getasString();
   }
      //wrapperclass
       public  class statedetails{
       public string stateName{get;set;}
       public string value{get;set;}
       public integer rating{get;set;}
       }
}

Note: After editing the input and clicking on the Button, iam not getting the changed  dynamic format . 
thanks 
deepika
 
public class testingarryfuction {

 
   public StateInfodetails StateInfodetailswraper{get;set;}
   
    public  testingarryfuction (){
    
    
     string teststring ='{ "sucess":1,"data":{"Stateidselected":"2","StateInfodetails":{"stateName": "Andrapradesh","value": "apx" ,"rating":5}}}';

    Map<String, Object> maptest =   (Map<String, Object>) JSON.deserializeUntyped(teststring);
          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 );
      
       StateInfodetailswraper = (StateInfodetails)System.JSON.deserialize(srlze,StateInfodetails.class);
     system.debug('deserilize using the wrapperclass::::::'+StateInfodetailswraper );
      system.debug(StateInfodetailswraper.stateName);
    }
    
    
     //this is a wrapper class 
     public class StateInfodetails{
     public string stateName{get;set;}
     public string  value{get;set;}
     public integer rating{get;set;}
    
   }

   
   
   
  
}


Visualforce page:

 
<apex:page controller="testingarryfuction" >
   <apex:form >
     Name: <apex:inputText value="{!StateInfodetailswraper.stateName}" /> <br/><br/>
    
      Value: <apex:inputText value="{!StateInfodetailswraper.value}" /> <br/><br/>
      
       rating: <apex:inputText value="{!StateInfodetailswraper.rating}" /> <br/><br/>
       
       
    </apex:form>
    
</apex:page>

Result:
After deserilizing with the  StateInfodetails wrapperclass,iam gettng the values as null..! can anyone help me to resolve this solution. thanks you..