function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
MM SaikumarMM Saikumar 

Parameters are not passing into controller with actionsupport

i am unable to pass parameters into controller from actionsupport

<apex:page controller="paramtest">
<apex:form >
  <apex:pageBlock >
      <apex:pageBlockTable value="{!acclist}" var="a">
          <apex:column ><apex:inputCheckbox ><apex:actionSupport action="{!nothing}" event="onchange"><apex:param value="{!a.id}" name="{!bee}" assignTo="{!bee}"/></apex:actionSupport></apex:inputCheckbox></apex:column>
          <apex:column ><apex:outputText value="{!a.name}"></apex:outputText></apex:column>
      </apex:pageBlockTable>
  </apex:pageBlock>
  </apex:form>
</apex:page>


public with sharing class paramtest {

    public PageReference nothing() {
    string beenn= ApexPages.currentPage().getParameters().get('bee');
    system.debug('from constructor '+beenn);
        return null;
    }


    public list<account> acclist { get; set; }
    public string bee {get;set;}
    
    public paramtest(){
    
    
    acclist=[select id,name from account];
    
    }
}
Best Answer chosen by MM Saikumar
mritzimritzi
@saiKumar

I have modified your code a bit, and its working fine.

Apex:
public with sharing class paramtest{
    //code change here
    public void nothing() {
        str = String.valueOf(bee);
    }

    public String str{get;set;}
    public list<account> acclist{ get; set; }
    //code changed here
    public Id bee{get;set;}
    
    public paramtest(){
        acclist=[select id,name from account];
    }
}

VF:
<apex:page controller="paramtest">
    <apex:form id="form">
      <apex:pageblock id="pb1">
          <!-- added both variables to verify that both values are getting captured correctly-->
          <h4>{!str}---{!bee}</h4>
      </apex:pageblock>
      <apex:pageBlock >
          <apex:pageBlockTable value="{!acclist}" var="a">
              <apex:column >
                  <apex:inputCheckbox >
                      <apex:actionSupport action="{!nothing}" event="onclick" rerender="pb1">
                          <apex:param id="bee" name="bee" value="{!a.id}" assignTo="{!bee}"/>
                      </apex:actionSupport>
                  </apex:inputCheckbox>
              </apex:column>
              <apex:column ><apex:outputText value="{!a.name}"></apex:outputText></apex:column>
          </apex:pageBlockTable>
      </apex:pageBlock>
    </apex:form>
</apex:page>


Select it as Best Answer, if it solves your problem.