You need to sign in to do that
Don't have an account?
SalesforceLearnerNewbie
how to pass the value from apex:repeat to controller
I have a List of IDs "a" = ["12dfd1", "123hte32", "dslkf3134"]
and when I use in VF page.
I do not know how to pass this var = "t" within the repeat apex command back to controller. I want it to pass the value from 12dfd1, 123hte32 to dslkf3134 one by one.
I created public String get_id {get;set;} in apex controller but how can I store the value from the apex:repeat after it loop each value. I need the value to be loop one by one and printed on VF page and then these value each will send back to controller based on the "var" if possible
and when I use in VF page.
I do not know how to pass this var = "t" within the repeat apex command back to controller. I want it to pass the value from 12dfd1, 123hte32 to dslkf3134 one by one.
I created public String get_id {get;set;} in apex controller but how can I store the value from the apex:repeat after it loop each value. I need the value to be loop one by one and printed on VF page and then these value each will send back to controller based on the "var" if possible
Thanks,
Govindaraj.S
List<DataLoadTest__c> lstdlt = new List<DataLoadTest__c>(); public List<DataLoadTest__c> getRecords() { lstdlt=[select Id,name from DataLoadTest__c]; return lstdlt;
I cant understand from the code you share, could you help me to check my code instead??
after receiving the information from an external API:
such as
{data=({id=c89278c0-4e21-4468-b85b-c18ba4252e87, valid=false, word=I try to get something, task=()}, {id=304264d2-9c15-40c7-bce5-e1aa605edfa8, valid=true, word=I trying to use salesfroce apex, task=({id=d567f0b8-3f14-42a3-863b-b9fd868b3976, info={total=no value, location=dunno、}, task=Will send email})}
Then my controller will be like this :
public with sharing class calloutViewer_Controller {
public void get_words()
{
checking = s_id;
httpResponse res = APIExchange.get_words('GET', checking);
responseBody = res.getBody();
Map<String, Object> results = (Map<String, Object>) JSON.deserializeUntyped(res.getBody());
List<Object> candidates = (List<Object>) results.get('data');
for (Object candidate: candidates) {
Map<String, Object> candidatee = (Map<String, Object>)candidate;
ss_id = (String)candidatee.get('id');
task = (String)candidatee.get('task');
}
}
My APIEchange file is:
public static httpResponse get_words(String httpMethod, String endpoint)
{
httpRequest req = new httpRequest();
req.setMethod('GET');
req.setEndpoint('https://ap1.salesforce.com/' + endpoint);
httpResponse res = new http().send(req);
return res;
}
My VF page is below:
<apex:repeat value="{!listA}" var="t" >
<apex:param name="s_id" value="{!t}" assignTo="{!s_id}" />
<apex:pageBlockTable value="{!word}" var="var">
<apex:column headerValue="Word {!task_index + 1 }">
{!t}<br />
</apex:column>
</apex:pageBlockTable>
My "listA" actually is in the form like this [[I trying to use salesfroce apex],[xxxxxxxxxx]]. My word is actually gotten from this.
Map<String, Object> results = (Map<String, Object>) JSON.deserializeUntyped(res.getBody());
List<Object> candidates = (List<Object>) results.get('data');
listA = new List<String>();
for (Object candidate: candidates) {
Map<String, Object> candidatee = (Map<String, Object>)candidate;
Boolean valid= (Boolean)candidate.get('valid');
if(valid== True){
word= (String)candidatee.get('word');
listA.add(word);
Can anyone assist me in this please, its urgent.