You need to sign in to do that
Don't have an account?
sheila srivatsav
actionsupport issue
I am displaying a list of account record with a checkbox
so when the user checks a record then I need the ID of that selected record in controller for further processing.
I am using actionsupport for this but I am unable to get the ID of the selected record in controller.
Please let me know where I am going wrong and if there is a better way of doing this.
visualforce page
thanks
sheila
so when the user checks a record then I need the ID of that selected record in controller for further processing.
I am using actionsupport for this but I am unable to get the ID of the selected record in controller.
Please let me know where I am going wrong and if there is a better way of doing this.
public class ActionSupportParamDemoController { public Id targetAccountId; public Id selectedAccountId { get; set; } public ActionSupportParamDemoController(ApexPages.StandardController controller) { } public List<Account> getAccounts() { return [select ID,Name,Active__c from Account order By name LIMIT 10]; } public PageReference handleCheckBoxChange() { system.debug('target accountid ='+targetAccountId); selectedAccountId = targetAccountId; system.debug('target accountid ='+targetAccountId); system.debug('selected account ID ='+selectedAccountId); return null; } //own method public Id getTargetAccountId() { return targetAccountId; } public void setTargetAccountId(Id value) { targetAccountId = value; } }
visualforce page
<apex:page standardController="Account" extensions="ActionSupportParamDemoController"> <apex:form> <apex:repeat value="{!Accounts}" var="accn"> <apex:inputCheckbox value="{!accn.Active__c}"> <br/> <apex:actionSupport event="onchange" action="{!handleCheckBoxChange}"> <apex:param id="account" name="accnId" value="{!accn.ID}" assignTo="{!targetAccountId}"/> </apex:actionSupport> </apex:inputCheckbox> {!accn.Name} </apex:repeat> {!selectedAccountId} </apex:form> </apex:page>
thanks
sheila
If you are passing something use param tag , then you need to rerender the page to send values to controller Hope this helps.
All Answers
If you are passing something use param tag , then you need to rerender the page to send values to controller Hope this helps.
I understood; got the result
thanks very much.