You need to sign in to do that
Don't have an account?
Deepikareddy
Working with the REPEAT FUNCTIONALITY in salesforce
iam getting an error while addding the data to the Selectlist using the Repeat functionality ..!
Visualforce page:
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 ..!
What Kind of ERROR you are getting you are getting.
Visualforce Error
Help for this Page
Invalid selectOptions found. Use SelectOption type in Apex.