You need to sign in to do that
Don't have an account?
Deepikareddy
onclicking on the test button , the values are to be displayed, how to achieve this functionality ?
Thanks in advance
Apex input checkbox selection
public class class2 { public list<string> lststatename{get;set;} public list<string> lstrating{get;set;} public map<string, string>statemap{get;set;} public list<string>selectedvalues{get;set;} public class2(){ string jsonexample1 = ' { "data": [ {"stateName": "Andrapradesh", "value": "apx" }, { "stateName": "Telangana", "value":"tsx"}, {"stateName": "Banglore", "value": "bngx"} , {"stateName": "Maharastra", "value":"mhx" } ] } '; map<string,object> metadatamap= (map<string,object>)json.deserializeuntyped(jsonexample1); list<object> values1= (list<object>)metadatamap.get('data'); 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 value = string.valueof(values.get('value')); lststatename.add(statename); statemap.put(statename, value); } } public PageReference test(){ //code to be written return null; } }
<apex:page controller="class2"> <apex:form > <ul style="list-style-type: none;"> <apex:repeat value="{!lststatename}" var="a"> <li ><apex:inputCheckbox value="{!statemap[a]}" /><label>{!a}</label></li> </apex:repeat> </ul> <apex:commandButton action="{!test}" value="Test" reRender="fm"/> <apex:outputLabel id="fm"> the selected values are : </apex:outputLabel> </apex:form> </apex:page>
onclicking on the test button , the values are to be displayed, how to achieve this functionality ?
Thanks in advance
Please follow the below code.
Hope it helps for you.
If it works fine please mark as a best answers so that it helps others too.
Thanks,
Shaik Murthujavali
All Answers
I think you have to go with wrapper class.For the check box functionality you have to write the wrapper class and in that just query the data and return it. call that wrapper class in your test method.
Please let me if it helps
thanks
Please follow the below code.
Hope it helps for you.
If it works fine please mark as a best answers so that it helps others too.
Thanks,
Shaik Murthujavali
thanks
deepika