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
vino2vijayvino2vijay 

call actionfunction with parameter from pageblocktable - Need to send dynamic param to controller

Hi All,

How to call actionfunction method with parameter from pageblocktable . I need to send dynamic param from selectlist ... below my code for reference please let me know if anyone find any solutions.

APEX Code :

============================

<apex:page controller="DLMQuestions">
  <apex:form id="form" >
<apex:pageBlock title="DLMQuestions">
  <apex:pageMessages ></apex:pageMessages>
  <apex:pageBlockTable value="{!qDLM}" var="row">
  <apex:column value="{!row.Name}"/>
     <apex:column value="{!row.Question__c}"/>
     <apex:column headerValue="Input Required">
    
    <apex:selectList size="1" onchange="method">
            <apex:selectOptions value="{!Items}"/>
        </apex:selectList>
          
         </apex:column>
     <apex:column value="{!row.MRBOption__c}"/>

  </apex:pageBlockTable>
</apex:pageBlock>
<apex:actionFunction action="{!methodOne}" name="method" reRender="">
        <apex:param name="firstParam"  value="Name" />
    </apex:actionFunction>

</apex:form></apex:page>

 

Controller :

=====================================

public class DLMQuestions
{
   

   public List<DLMQuestion__c> qDLM { get; set; }
   public String[] ansList {get;set;}
   public Integer i {get;set;}
    
    public DLMQuestions()
    {
        LoadData();
    }
   
    public void LoadData()
    {
        qDLM=[select Name,Question__c,RRBOption__c,MRBOption__c from DLMQuestion__c limit 1];   
        //StringManipulation();
    }
       public List<SelectOption> getItems()
     {
                         
            List<SelectOption> options = new List<SelectOption>();
             for(DLMQuestion__c Q : qDLM)
             {
                 options.add(new SelectOption(Q.RRBOption__c,Q.RRBOption__c));
             }
            return options;
      }
      public void methodOne()
       {
       }


}

Best Answer chosen by Admin (Salesforce Developers) 
Abhay AroraAbhay Arora

Hi ,

 

Please mark this issue as solved

All Answers

Abhay AroraAbhay Arora

 <apex:selectlist value="{!val}" onChange="updatePanel('{!passMeToContrl}')"   size="1">

 

        <apex:actionFunction name="updatePanel"
            action="{!handelParaCTRl}" reRender="panel">
            <apex:param name="param2passName" assignTo="{!paramValueFromPage}"           value="" />
        </apex:actionFunction>

 

and in your controller

 

    public string paramValueFromPage{get;set{
            paramValueFromPage=value;      
     }
    }

 

Please mark this as solved if above is what you need

vino2vijayvino2vijay

Hi Abhay 

Its worked fine for me ... Thanks for great help :)

Abhay AroraAbhay Arora

Hi ,

 

Please mark this issue as solved

This was selected as the best answer