Find your content:

Search form

You are here

How to pass more than one parameter to an actionFunction?

<a href="javascript:;" onclick="if(confirm('Are you sure?'))

<img src="{!$Resource.Red_Cross}" alt="Remove" title="Remove" /></a>

<apex:actionFunction name="remove2" action="{!removeoppline2}" reRender="thePB">
    <apex:param name="name" value="rono" assignTo="{!proname}" />

I also want to send record id like {!} on remove image can i send both line number and recordid help me with it


for(OpportunityLineItem l:lOpp) {    
    wrapperopllist.add(new linenumberclass(l,m));

  <apex:repeat value="{!wrapperopllist}" var="oplist" rows="{!PageSize}" id="wrapid">

    <tr height="50px">
        <td class="Tdtext">{!oplist.lineNumber}
            <div id="{!rno}" style="display:none">
                <apex:image value="{!$Resource.Warning_Image}" height="15px" id="im" />
        <td class="Tdtext">{!}


        <td class="Tdtext">
            <apex:inputField value="{!oplist.oppLineNo.Exclusive__c}" />
        <td class="Tdtext">
            <apex:inputField value="{!oplist.oppLineNo.TV_Everywhere__c}" />
        <td class="Tdtext">
            <apex:inputField value="{!oplist.oppLineNo.Description}" />
        <td class="Tdtext">

            <a href="javascript:;" onclick="if(confirm('Are you sure?')){remove1('{!}','{!oplist.lineNumber}');}">
                                   <img src="{!$Resource.Red_Cross}" alt="Remove" title="Remove" />
            <apex:variable value="{!rno+1}" var="rno" />



<apex:actionFunction name="remove1" action="{!removeoppline}" reRender="thePB">
    <apex:param name="id" value="rno" assignTo="{!deleteid}" />

    <apex:param name="name" value="rno" assignTo="{!proname}" />

remove method

public void removeoppline() {

    for(Integer i = proname-1; i < wrapperopllist.size(); i++) {

Attribution to: Mik

Possible Suggestion/Solution #1

StackExchange Tip: You should update your question (and ensure future ones) to something more generic like 'How to pass more than one parameter to a actionFunction?'. And try to provide as much background as you can about the information being displayed/manipulated.

Answer: Assuming you can obtain the Id via the 'oplist' binding, and given what you've shared about this on a previous quesiton, this should work just fine...

remove2('{!oplist.lineNumber1}', '{!opList.oppLineNo.Id}');

Then add a second apex:param like so...

<apex:actionFunction name="remove2" action="{!removeoppline2}" reRender="thePB">
  <apex:param name="name" value="rono" assignTo="{!proname}"/>
  <apex:param name="id" value="rono" assignTo="{!proid}"/>

NOTE: Make sure to expose 'proid' as a new controller variable, much like you have 'proname'.

The important thing with actionFunction parameters is to pass them in the correct order, although they are named, the name does not really get used. As you can see above, it's the order they are passed.

Attribution to: Andrew Fawcett
This content is remixed from stackoverflow or stackexchange. Please visit

My Block Status

My Block Content